Skip to content

Interface: JSONSchema

@providerprotocol/ai


@providerprotocol/ai / @providerprotocol/ai / JSONSchema

Defined in: src/types/schema.ts:149

Root JSON Schema for tool parameters or structured outputs.

This is the top-level schema definition used when defining tool parameters or requesting structured output from an LLM.

const weatherToolSchema: JSONSchema = {
type: 'object',
description: 'Parameters for getting weather information',
properties: {
location: {
type: 'string',
description: 'City name or coordinates'
},
units: {
type: 'string',
enum: ['celsius', 'fahrenheit'],
description: 'Temperature units'
}
},
required: ['location']
};

optional additionalProperties: boolean

Defined in: src/types/schema.ts:160

Whether additional properties are allowed beyond those defined


optional description: string

Defined in: src/types/schema.ts:163

Human-readable description of the schema’s purpose


properties: Record<string, JSONSchemaProperty>

Defined in: src/types/schema.ts:154

Property definitions for the object


optional required: string[]

Defined in: src/types/schema.ts:157

List of required property names


type: "object"

Defined in: src/types/schema.ts:151

Root schemas are always objects