Skip to content

Function: zodToJSONSchema()

@providerprotocol/ai


@providerprotocol/ai / utils / zodToJSONSchema

zodToJSONSchema(schema): Promise<JSONSchema>

Defined in: src/utils/zod.ts:161

Converts a Zod schema to JSON Schema.

For Zod v4+, uses native z.toJSONSchema(). For Zod v3, uses zod-to-json-schema package.

ZodLike

Zod schema to convert

Promise<JSONSchema>

JSON Schema representation

Error if required dependencies are not installed