Repository navigation
fix: publish tool schemas as JSON Schema 2020-12 - #268
Merged
Merged
Conversation
Claude Desktop rejects any tool whose outputSchema declares draft-07
("JSON Schema declares an unsupported dialect"). McpServer in SDK 1.x
always generates draft-07, so wrap setRequestHandler on our server
instance and convert the tools/list schemas to 2020-12: relabel
$schema, tuple items -> prefixItems, definitions -> $defs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jussi-sa
previously approved these changes
Oct 7, 2026
…2020-12 # Conflicts: # CHANGELOG.md
jussi-sa
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In Claude Desktop, calls to tools that declare an output schema fail with:
Of our 29 tools, 28 declare an output schema. The same tools work from Claude Code, so this depends on the client.
Cause
McpServergenerates every tool'sinputSchemaandoutputSchemaas draft-07 and offers no option to change it. That's true in 1.30.0 (ours) and in 1.32.1, the latest on npm. MCP specifies 2020-12 as the default dialect, and Claude Desktop's newer client enforces that.Changing only the
$schemalabel would not be enough. 30 schema nodes are tuples (bbox, coordinate pairs), which draft-07 writes asitems: [...], a form 2020-12 doesn't allow.Fix
publishJsonSchema2020()(src/utils/jsonSchema2020.ts) wrapssetRequestHandleron our own server instance before any tool is registered. The SDK installs itstools/listhandler through that method, so the handler gets wrapped and its schemas are converted on the way out:$schemalabel becomes 2020-12;items: [...]becomesprefixItems, andadditionalItemsbecomesitems;definitionsbecomes$defs, with refs rewritten to match.The conversion walks only real subschema positions, so a property named
itemsordefinitionsis left alone. It isn't a global patch, and the SDK's own validation of tool input and output still runs against the zod schemas as before.Testing
search_and_geocode_toolresult validates against its converted output schema.🤖 Generated with Claude Code