Skip to content

compileInputSchema

function compileInputSchema(schema: ZodType): JsonSchema;

Compile a Zod schema to a JSON Schema object suitable for inputSchema.

The schema is emitted fully inline, so the result is a self-contained object schema with no top-level $ref. A non-object root (e.g. z.string()) is rejected — tool arguments are always a named-field object.

ParameterTypeDescription
schemaZodTypeThe Zod schema for a tool’s arguments.

JsonSchema

A JSON Schema object with type: 'object'.

If the schema does not compile to an object schema.