MCPcopy
hub / github.com/CopilotKit/CopilotKit / toJsonSchema

Function toJsonSchema

packages/bot/src/standard-schema.ts:44–57  ·  view source on GitHub ↗
(
  schema: StandardSchemaV1,
)

Source from the content-addressed store, hash-verified

42 * most LLM tool-call APIs reject composite `$ref` schemas.
43 */
44export function toJsonSchema(
45 schema: StandardSchemaV1,
46): Record<string, unknown> {
47 return sharedSchemaToJsonSchema(schema, {
48 // Adapt `zod-to-json-schema`'s `(schema: ZodType, ...)` signature to
49 // shared's `(schema: unknown, ...)` injection point. Only invoked for
50 // Zod v3 inputs that don't emit Standard JSON Schema themselves.
51 zodToJsonSchema: (s, options) =>
52 zodToJsonSchema(
53 s as Parameters<typeof zodToJsonSchema>[0],
54 options as never,
55 ) as Record<string, unknown>,
56 });
57}
58
59/** Discriminated result of validating a value against a Standard Schema. */
60export type SchemaParseResult<T> =

Callers 2

toCommandSpecFunction · 0.70
toAgentToolDescriptorsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…