editor icon indicating copy to clipboard operation
editor copied to clipboard

MCP tool output schemas declare `draft-07` dialect — rejected by clients enforcing JSON Schema 2020-12

Open seasonsbrick-cell opened this issue 3 months ago • 1 comments

What happened?

Every tool call against the local @pascal-app/mcp server fails immediately with a schema validation error, even though the server process itself starts and runs fine:

Error: Tool '<tool_name>' has an invalid outputSchema: JSON Schema declares an unsupported dialect ("$schema": "http://json-schema.org/draft-07/schema#"). The default validator supports JSON Schema 2020-12 only; pass a pre-configured Ajv instance to AjvJs

Confirmed to affect every tool tried, including: list_levels, get_walls, export_json, create_project, list_scenes.

Environment:

  • Package: @pascal-app/mcp (installed via bunx @pascal-app/mcp, unpinned/latest tag as of 2026-08-20)
  • Client: Claude Desktop (macOS), via its MCP connector config
  • The server itself starts fine standalone (bunx @pascal-app/mcp prints "[pascal-mcp] stdio server running" and hangs waiting for a client) — so this is specifically about how tool output schemas are declared, not a startup/connectivity issue.
  • Refreshing the client's tool list and fully restarting the MCP connection does not change the error.

Steps to reproduce

  1. Configure @pascal-app/mcp as an MCP server in Claude Desktop (bunx @pascal-app/mcp)
  2. Call any tool, e.g. list_levels, get_walls, or export_json
  3. See the outputSchema validation error above instead of a result

Expected behavior

The tool call should succeed and return the requested data. The outputSchema fields should use the JSON Schema 2020-12 dialect (or omit/correctly declare $schema) so MCP clients with strict validators (like Claude Desktop's) can validate the response.

Browser & OS

macOS (Claude Desktop), Node/bun runtime via bunx @pascal-app/mcp

Screenshots or screen recordings

No response

Additional context

No response

seasonsbrick-cell avatar Aug 20 '26 22:08 seasonsbrick-cell

Confirmed, and thanks for the precise error text — it pointed straight at the cause.

This is an upstream default we're inheriting. The MCP SDK's McpServer converts tool schemas via toJsonSchemaCompat without passing a target, and the compat layer's fallback is draft-7. I reproduced it against our installed SDK and zod 4.4.3:

{"$schema":"http://json-schema.org/draft-07/schema#","type":"object",...}

I checked whether upgrading fixes it — it doesn't. SDK 1.30.0 has the same default and the same call sites with no target, and we're already on zod v4, so there's no version bump that gets us out of this. registerTool also has no JSON-Schema passthrough, so we can't hand it a pre-built 2020-12 schema.

The fix is on us anyway and it's small: re-register the tools/list handler after tool registration and normalize $schema on the way out. The SDK exposes removeRequestHandler, so that's about a dozen lines. Doing that rather than waiting on upstream, since your client is right to reject the dialect and every tool being unusable is not an acceptable state.

One note for whoever picks this up: our existing output-schema contract test won't catch this class of bug, because it validates through the SDK's own client instead of a strict 2020-12 validator. The regression test needs to assert on the raw tools/list payload.

Aymericr avatar Aug 28 '26 03:08 Aymericr