zodToJsonSchema
zodToJsonSchema(
schema):ToolInputJsonSchema
Defined in: packages/core/src/mcp/tools/index.ts:206
Convert a tool’s Zod input schema to the JSON Schema (draft-07) shape
advertised to MCP clients via tools/list.
Uses Zod v4’s native z.toJSONSchema() so every construct tools actually
use — enums, arrays, nested objects/records, .default(), .nullable(),
.optional(), coerced numbers — produces a correct properties entry and
an accurate required list. (The previous hand-rolled converter only
emitted string/number/boolean properties and marked ZodDefault fields as
required while omitting them from properties.)
Parameters
Section titled “Parameters”schema
Section titled “schema”ZodType