Schema: Is draft 07 strictly followed? #366
Replies: 5 comments 3 replies
-
As I learn MCP spec, I am looking for clarity, along with others, on
Hope these questions help the discussion. |
Beta Was this translation helpful? Give feedback.
-
Hey there! I'm a TSC member of JSON Schema. To avoid ambiguity, as @jokemanfire pointed out, the MCP specification should clearly define what dialect of JSON Schema is in use. That could be JSON Schema Draft 7 or the newest JSON Schema 2020-12 dialect. While a bit more advanced, this is how OpenAPI itself does it: https://spec.openapis.org/oas/latest.html#json-schema-keywords.
As some extra resources worth keeping an eye on:
Of course, if the MCP team needs any assistance with JSON Schema, don't hesitate in reaching out to us. We are friendly :) https://json-schema.org |
Beta Was this translation helpful? Give feedback.
-
Other notes and examples: The spec mandates fatal validation and the error code – the Tools section’s Security Considerations says servers “MUST validate all tool inputs,” and the Error-Handling example shows JSON-RPC -32602 for invalid params. specification/2025-03-26/server/tools Concrete bug triggered by empty or missing arguments – several SDKs (e.g., TypeScript v1.9.0) and clients (Windsurf) throw Anthropic production API is a strict outlier – it rejects any schema that isn’t Draft 2020-12, returning Something related; OpenAPI-style "nullable": true is not legal JSON Schema – strict validators expect anyOf or ["T","null"]; A workaround for no-arg tools may be to publish or default to an explicitly empty schema, but seems a hack. |
Beta Was this translation helpful? Give feedback.
-
Some related issues I found from a quick search:
And some options for MCP off the top of my head:
|
Beta Was this translation helpful? Give feedback.
-
An explicitly empty JSON Schema is {
"$schema": "https://json-schema.org/draft/2020-12/schema"
} This means the schema is unconstrained but defined as a 2020-12 complaint instance. The problem with using |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-submission Checklist
Question Category
Your Question
There is currently no clear indication in the spec file to follow the draft-07.
This has led to many conflicting parts in the development of SDKs, especially with mainstream clients such as cursor and claude or inspector using different schema, there have been some issues with the development of the SDK. Can the schema specification used be clearly specified in the spec file?
Beta Was this translation helpful? Give feedback.
All reactions