Uh oh!
There was an error while loading. Please reload this page.
fix: support MCP JSON Schema dialects - #1547
Conversation
WalkthroughThe change adds shared MCP JSON Schema validation for three dialects, preserves schema declarations in tool validation, formats validation errors, and stages per-server tools before atomic registration. ChangesMCP schema validation and tool assembly
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant MCPServer
participant mcpToolSets
participant compileMcpJsonSchemaValidator
participant ToolRegistry
MCPServer->>mcpToolSets: provide tool schemas
mcpToolSets->>compileMcpJsonSchemaValidator: compile each schema
compileMcpJsonSchemaValidator-->>mcpToolSets: return validator or schema error
mcpToolSets->>ToolRegistry: merge tools after server processing succeeds
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This comment has been minimized.
This comment has been minimized.
21d0b1b to
434fb04CompareNote GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
$schemato 2020-12, as required by the MCP specification.Note
Medium Risk
Changes runtime MCP tool schema compilation and which tools load in Ask EE; behavior shifts for connectors that relied on the old draft-07-only path or forced additionalProperties, though failures are isolated per server.
Overview
Fixes Ask MCP connectors failing to load when tool
inputSchemadeclares JSON Schema 2019-09 or 2020-12 (MCP’s default when$schemais omitted).Validation no longer uses a single draft-07 Ajv instance or forces
additionalProperties: falseon every tool. Schemas are compiled with the matching Ajv dialect (draft-07,2019-09,2020-12), with guards for unsupported dialects,$async, and shared$idcollisions (addUsedSchema: false).Tool loading is per-server atomic: if any tool schema is unsupported or fails to compile, that server is marked failed and no partial tools from that server are exposed. Error logging avoids echoing sensitive schema URIs or tokens.
Reviewed by Cursor Bugbot for commit 434fb04. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
Bug Fixes