Skip to content

Documentation / @agentick/kernel / toJSONSchema

Function: toJSONSchema() ​

toJSONSchema(schema, options?): Promise<Record<string, unknown>>

Defined in: kernel/src/schema.ts:199

Convert any supported schema to JSON Schema format.

Supports:

  • Zod 4 (uses z.toJSONSchema)
  • Zod 3 (uses zodToJsonSchema if available, otherwise returns empty)
  • Standard JSON Schema (uses ~standard.jsonSchema.input)
  • Standard Schema (returns empty - no JSON Schema support)
  • JSON Schema (pass through)

Parameters ​

schema ​

unknown

The schema to convert

options? ​

ToJSONSchemaOptions = {}

Conversion options

Returns ​

Promise<Record<string, unknown>>

JSON Schema object

Released under the ISC License.