tools/list advertises $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.
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 $schema string; no draft-07-only constructs present). So createPerplexityServer now wraps the SDK's tools/list handler 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
New test: in-memory client calls tools/list and asserts 2020-12 on all input and output schemas. Fails without the fix, passes with it.
Full suite: 90/90 passing, npm run build clean.
Manually confirmed against a strict 2020-12-only Ajv validator: all 8 schemas compile after the fix.
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
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/list advertises $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-schema defaults 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 $schema string; no draft-07-only constructs present). So createPerplexityServer now wraps the SDK's tools/list handler 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