Skip to content

toJsonObjectSchema

function toJsonObjectSchema(schema, label?): JsonObjectSchema;

Defined in: core/src/zod.ts:19

A zod schema as the JSON Schema every provider’s tool contract wants.

$schema is dropped. zod emits the dialect URI at the root, and a provider validating a tool’s parameters against its own supported subset (OpenAI under strict: true, Gemini’s parametersJsonSchema) rejects the whole tool over that one key, with a message that names neither zod nor the field.

Parameter Type Default value
schema ZodType undefined
label string "schema"

JsonObjectSchema