-
Notifications
You must be signed in to change notification settings - Fork 1.4k
SEP-1613: Establish JSON Schema 2020-12 as Default Dialect for MCP #655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5015b6f
de40ca5
8aaede2
29dc3d6
220eb46
2747ccf
d2e2f1d
3332e6e
747d70b
609cac1
b3593b0
46bb011
a9b949c
d18b90e
abee932
3396719
9c81b3d
278c1fd
97a2b21
e045a57
e2cf924
ae487bc
42b4202
8a30474
19ec849
0e22cd4
3996fd3
de4c3b3
8142c0b
c4d9979
c686ec2
098bbf2
be37ecc
3549d6f
7ed8fb3
27626dd
ebe0126
12d8601
ef16677
10cfd6b
9490dd9
c523428
04f2ae0
0813d3c
d7c9587
cb573d5
909738c
9febb60
8461581
a938672
f613dcf
e16aa3b
b6a1c24
42f47a4
671c6b8
ad2664f
cbbfc6a
fdd681b
b97ed92
98431c6
343b9d7
b0a9563
5ecd51d
0c9f98e
c1621d0
9f9b3a1
5c4a992
69adf1b
f870566
45bc08f
7ff1511
49637ea
eee9af6
7866033
0aae433
e9d025d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,14 +194,20 @@ A tool definition includes: | |
| - `title`: Optional human-readable name of the tool for display purposes. | ||
| - `description`: Human-readable description of functionality | ||
| - `inputSchema`: JSON Schema defining expected parameters | ||
| - Follows the [JSON Schema usage guidelines](/specification/draft/basic#json-schema-usage) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this link point to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question, do you think its better not to link directly here?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like @jonathanhefner might have ideas or thoughts on this? :) |
||
| - Defaults to 2020-12 if no `$schema` field is present | ||
| - **MUST** be a valid JSON Schema object (not `null`) | ||
| - For tools with no parameters, use one of these valid approaches: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We chatted about whether this guidance is really needed here, since technically the schema for MCP already says that it has to be an object. However, the original GitHub discussions showed widespread confusion around this, especially since JSON Schema 2020-12 would allow boolean schemas like
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dsp-ant I left this extra explanation in, but didn't add anything explicit for other schemas (such as output schemas) because this seemed to be the main need for extra clarification. |
||
| - `{ "type": "object", "additionalProperties": false }` - **Recommended**: explicitly accepts only empty objects | ||
| - `{ "type": "object" }` - accepts any object (including with properties) | ||
| - `outputSchema`: Optional JSON Schema defining expected output structure | ||
| - Follows the [JSON Schema usage guidelines](/specification/draft/basic#json-schema-usage) | ||
| - Defaults to 2020-12 if no `$schema` field is present | ||
| - `annotations`: optional properties describing tool behavior | ||
|
|
||
| <Warning> | ||
|
|
||
| For trust & safety and security, clients **MUST** consider | ||
| tool annotations to be untrusted unless they come from trusted servers. | ||
|
|
||
| For trust & safety and security, clients **MUST** consider tool annotations to | ||
| be untrusted unless they come from trusted servers. | ||
| </Warning> | ||
|
|
||
| #### Tool Names | ||
|
|
@@ -390,6 +396,56 @@ Providing an output schema helps clients and LLMs understand and properly handle | |
| - Guiding clients and LLMs to properly parse and utilize the returned data | ||
| - Supporting better documentation and developer experience | ||
|
|
||
| ### Schema Examples | ||
|
|
||
| #### Tool with default 2020-12 schema: | ||
|
|
||
| ```json | ||
| { | ||
| "name": "calculate_sum", | ||
| "description": "Add two numbers", | ||
| "inputSchema": { | ||
| "type": "object", | ||
| "properties": { | ||
| "a": { "type": "number" }, | ||
| "b": { "type": "number" } | ||
| }, | ||
| "required": ["a", "b"] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| #### Tool with explicit draft-07 schema: | ||
|
|
||
| ```json | ||
| { | ||
| "name": "calculate_sum", | ||
| "description": "Add two numbers", | ||
| "inputSchema": { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "type": "object", | ||
| "properties": { | ||
| "a": { "type": "number" }, | ||
| "b": { "type": "number" } | ||
| }, | ||
| "required": ["a", "b"] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| #### Tool with no parameters: | ||
|
|
||
| ```json | ||
| { | ||
| "name": "get_current_time", | ||
| "description": "Returns the current server time", | ||
| "inputSchema": { | ||
| "type": "object", | ||
| "additionalProperties": false | ||
| } | ||
| } | ||
| ``` | ||
olaservo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Error Handling | ||
|
|
||
| Tools use two error reporting mechanisms: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.