fix: advertise JSON Schema 2020-12 in tools/list - #141
Merged
rbuchmayer-pplx merged 3 commits intoAug 27, 2026
Merged
Conversation
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.
Fixes #132.
Problem
tools/listadvertises$schema: http://json-schema.org/draft-07/schema#on every input and output schema. Clients that only support JSON Schema 2020-12 (the dialect the MCP spec specifies) reject all 8 schemas before any tool is invoked, so every tool is unusable in those clients.Root cause is in the MCP TypeScript SDK: the zod v3 conversion path never sets a dialect target, so
zod-to-json-schemadefaults to draft-07 (modelcontextprotocol/typescript-sdk#2084). The upstream fix (modelcontextprotocol/typescript-sdk#2085) is not merged or released yet, so this patches it on our side.Fix
The schemas themselves are valid under both dialects (verified with a strict Ajv 2020-12 validator: 8/8 rejected as-is, 8/8 compile after changing only the
$schemastring; no draft-07-only constructs present). SocreatePerplexityServernow wraps the SDK'stools/listhandler and rewrites the declared dialect to 2020-12. This mirrors what the upstream fix does for zod v3 schemas. The shim touches a private SDK field and is meant to be removed once the SDK fix ships and we bump past it.Version goes to 1.2.1 so the fix publishes on merge.
Verification
tools/listand asserts 2020-12 on all input and output schemas. Fails without the fix, passes with it.npm run buildclean.