Skip to main content

inlineSchema

@webda/mcp


Function: inlineSchema()

inlineSchema(schema, resolve, maxDepth?): JsonSchema

Defined in: packages/mcp/src/schema.ts:26

Return a self-contained copy of a JSON schema with every $ref inlined.

MCP clients expect self-contained tool schemas. Local refs are looked up in the enclosing schema's definitions/$defs; anything else is resolved by name through resolve (Webda's dangling #/definitions/<modelId> refs). Cycles and unresolved refs become {} (accept anything).

Parameters​

schema​

JsonSchema

the schema to inline

resolve​

SchemaResolver

resolver for refs not defined locally

maxDepth?​

number = 8

maximum number of nested refs to follow

Returns​

JsonSchema

a new schema without $ref, definitions, $defs, $schema or $id