Skip to content

FetchJsonOpts

Options for ToolContext.fetchJson. Supply schema (as part of the call, not this base type) to validate and type the result via z.infer.

PropertyTypeDescription
errorMap?(res: Response, body: string) => ToolError | undefinedMap a non-2xx response to a custom ToolError, given the response and its already-read body text (so the upstream’s own error message can be surfaced). Return undefined to fall back to the default status mapping.
init?RequestInitStandard fetch init (method, headers, body).