Skip to content

fix: advertise JSON Schema 2020-12 in tools/list - #141

Merged
rbuchmayer-pplx merged 3 commits into
perplexityai:mainfrom
rbuchmayer-pplx:fix-2020-12-schema-dialect
Aug 27, 2026
Merged

fix: advertise JSON Schema 2020-12 in tools/list#141
rbuchmayer-pplx merged 3 commits into
perplexityai:mainfrom
rbuchmayer-pplx:fix-2020-12-schema-dialect

Conversation

@rbuchmayer-pplx

Copy link
Copy Markdown
Collaborator

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

  • 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.

@rbuchmayer-pplx
rbuchmayer-pplx merged commit c73c856 into perplexityai:main Aug 27, 2026
2 checks passed
@rbuchmayer-pplx
rbuchmayer-pplx deleted the fix-2020-12-schema-dialect branch August 27, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

All tools unusable in 2020-12-only clients: outputSchema declares draft-07 dialect

1 participant