Graphorin API reference v0.7.0
Graphorin API reference / @graphorin/tools / / projectSchemaToJsonSchema
Function: projectSchemaToJsonSchema()
ts
function projectSchemaToJsonSchema(raw, opts?):
| JsonSchemaRecord
| undefined;Defined in: packages/tools/src/schema/to-json-schema.ts:804
Project a tool's declared inputSchema / outputSchema - whatever the author supplied - onto a JSON Schema record fit for a provider wire body or a code-mode signature. Resolution order:
undefined/null→undefined.- A
toJSON()method → its result (MCP validators, hand-rolled schemas; a throwing/non-objecttoJSONfalls through). - A Zod v4 or v3 schema → zodToJsonSchema.
- Plain JSON-Schema-shaped data → passed through as-is.
- Anything else (an opaque validator this converter cannot read) →
undefined, reported viaonUnsupported- callers substitute a permissive{}rather than shipping serialized internals.
Parameters
| Parameter | Type |
|---|---|
raw | unknown |
opts | ProjectSchemaOptions |
Returns
| JsonSchemaRecord | undefined