Skip to main content

Function: dereferenceSchema()

dereferenceSchema(schema, spec, documents?): Record<string, unknown> | undefined

Defined in: http-server-mcp-openapi/src/schema.ts:194

Recursively inlines every $ref in a schema (including refs nested inside properties, items, oneOf, anyOf, etc.), producing a self-contained schema safe to hand to an MCP client or LLM provider as a tool definition — provider tool schemas have no components section to resolve refs against.

Refs into other files resolve against documents; see OpenApiDocuments.

Parameters​

ParameterType
schemaRecord<string, unknown> | undefined
specOpenApiSpec
documents?OpenApiDocuments

Returns​

Record<string, unknown> | undefined