/** * Builds a Zod schema from the JSON Schema a tool already publishes. * * WHY THIS EXISTS: validation used to be hand-written beside the advertised * definitions, and the two drifted in both directions. 43 of the 101 validated * tools pointed at a `z.record(z.string(), z.any())` placeholder that accepts * anything, and of the remaining 58, 18 had Zod schemas missing keys their own * advertised schema publishes -- so turning strictness on would have refused * documented options. Deriving removes the class of bug rather than the * instances: there is one description of a tool's arguments, and it is the one * the caller is shown. * * WHAT IT DOES NOT DO: it never applies a JSON Schema `default`. Parsed args go * straight to the tool body, and tools distinguish an absent option from a * supplied one (`options.useCache !== false`); materialising defaults here would * change behaviour that is not ours to change. The schema's defaults remain * documentation for the caller, which is what they were. */ import { z } from 'zod'; /** The subset of JSON Schema the tool definitions use. */ export interface JsonSchemaNode { type?: string | string[]; enum?: unknown[]; const?: unknown; properties?: Record; required?: string[]; items?: JsonSchemaNode; additionalProperties?: boolean | JsonSchemaNode; oneOf?: JsonSchemaNode[]; anyOf?: JsonSchemaNode[]; minimum?: number; maximum?: number; exclusiveMinimum?: number; exclusiveMaximum?: number; minLength?: number; maxLength?: number; minItems?: number; maxItems?: number; pattern?: string; format?: string; description?: string; default?: unknown; } /** Build the top-level argument schema for one tool definition. */ export declare const schemaFromDefinition: (inputSchema: JsonSchemaNode) => z.ZodTypeAny; //# sourceMappingURL=schema-from-definition.d.ts.map