Function: zodToJsonSchema()
ts
function zodToJsonSchema(schema): Readonly<Record<string, unknown>>;Defined in: schemas/zod-to-json-schema.ts:14
Converts a Zod schema (z.ZodTypeAny) into a deeply frozen JSON Schema object for LLM structured outputs and wire tool declarations.
Delegates directly to Zod v4's native z.toJSONSchema() converter (preserving .min(), .max(), .int(), .regex(), minItems, .default(), .optional(), unions, intersections, and descriptions) while stripping the top-level $schema URI.
Parameters
| Parameter | Type | Description |
|---|---|---|
schema | ZodTypeAny | Input Zod schema to convert. |
Returns
Readonly<Record<string, unknown>>
Deeply frozen JSON Schema representation of schema.