-
Notifications
You must be signed in to change notification settings - Fork 1.6k
SEP-2106: Tools inputSchema & outputSchema Conform to JSON Schema 2020-12
#2106
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
Merged
mcp-commander
merged 29 commits into
modelcontextprotocol:main
from
olaservo:sep-834-json-schema-2020-12
May 18, 2026
+997
−67
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
d5b0eab
feat: add SEP draft for full JSON Schema 2020-12 support
olaservo 9c93b3b
fix: update author format in SEP-0000 document
olaservo 8f0b866
fix: update sponsor name format in SEP-0000 document
olaservo a8ec1c1
SEP-834: Loosen schema type restrictions for full JSON Schema 2020-12…
olaservo d0467dd
SEP-834: Update reference implementation with weather forecast demo
olaservo c42cfbc
Update SEP
olaservo 4db09cd
SEP-2106: Rename file and update header per SEP-1850
olaservo 2355d8d
Fix prettier formatting
olaservo 7250539
Regenerate schema.mdx for draft spec changes
olaservo 9cfcdf9
Align SEP with John's original PR #881 intent
olaservo acdad08
Fix inputSchema to require type: "object" per original intent
olaservo 84e369d
Update SDK reference to 1.25.2-sep834.4
olaservo 8c820f2
Update server reference to 1.1.0-sep834.1
olaservo 8d7334f
Merge branch 'main' into sep-834-json-schema-2020-12
olaservo c58f0ea
Merge branch 'main' into sep-834-json-schema-2020-12
olaservo 63018d2
Fix SEP-2106 self-references, examples, and add docs page
olaservo 0e595cf
Regenerate SEP docs via render-seps script
olaservo 52a8149
Fix Prettier formatting in SEP-2106
olaservo af004c5
Merge branch 'main' into sep-834-json-schema-2020-12
olaservo 20a7cf5
Regenerate schema.mdx from schema.ts
olaservo 732bbd9
Merge upstream/main into sep-834-json-schema-2020-12
olaservo 384764c
Address review feedback on SEP-2106
olaservo d28391f
Format docs.json to match render-seps output
olaservo 9470201
Restore docs/community/seps/2243-http-standardization.mdx
olaservo 9e878c0
Distinguish original author from current shepherd in SEP-2106
olaservo d6b9ce8
Merge upstream/main into sep-834-json-schema-2020-12
olaservo 763ce86
Re-fix docs.json after upstream merge
olaservo d9cea28
Merge remote-tracking branch 'upstream/main' into sep-834-json-schema…
olaservo 7bff200
Merge main into sep-834-json-schema-2020-12
localden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -473,7 +473,7 @@ Embedded resources support the same [Resource annotations](/specification/draft/ | |
|
|
||
| #### Structured Content | ||
|
|
||
| **Structured** content is returned as a JSON object in the `structuredContent` field of a result. | ||
| **Structured** content is returned as a JSON value in the `structuredContent` field of a result. This can be any JSON value (object, array, string, number, boolean, or null) that conforms to the tool's `outputSchema` if one is defined. | ||
|
|
||
| For backwards compatibility, a tool that returns structured content SHOULD also return the serialized JSON in a TextContent block. | ||
|
|
||
|
|
@@ -545,6 +545,53 @@ Example valid response for this tool: | |
| } | ||
| ``` | ||
|
|
||
| Example tool with array output schema: | ||
|
|
||
| ```json | ||
| { | ||
| "name": "list_users", | ||
| "title": "User List", | ||
| "description": "Returns a list of all users", | ||
| "inputSchema": { | ||
| "type": "object", | ||
| "properties": {} | ||
| }, | ||
| "outputSchema": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { "type": "string" }, | ||
| "name": { "type": "string" }, | ||
| "email": { "type": "string" } | ||
| }, | ||
| "required": ["id", "name", "email"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Example valid response for a tool with array output: | ||
|
|
||
| ```json | ||
| { | ||
| "jsonrpc": "2.0", | ||
| "id": 6, | ||
| "result": { | ||
| "content": [ | ||
| { | ||
| "type": "text", | ||
| "text": "Found 2 users: Alice ([email protected]) and Bob ([email protected])." | ||
| } | ||
| ], | ||
| "structuredContent": [ | ||
| { "id": "1", "name": "Alice", "email": "[email protected]" }, | ||
| { "id": "2", "name": "Bob", "email": "[email protected]" } | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Providing an output schema helps clients and LLMs understand and properly handle structured tool outputs by: | ||
|
|
||
| - Enabling strict schema validation of responses | ||
|
|
||
13 changes: 13 additions & 0 deletions
13
schema/draft/examples/CallToolResult/result-with-array-structured-content.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "resultType": "complete", | ||
| "content": [ | ||
| { | ||
| "type": "text", | ||
| "text": "Found 2 users: Alice ([email protected]) and Bob ([email protected])." | ||
| } | ||
| ], | ||
| "structuredContent": [ | ||
| { "id": "1", "name": "Alice", "email": "[email protected]" }, | ||
| { "id": "2", "name": "Bob", "email": "[email protected]" } | ||
| ] | ||
| } | ||
30 changes: 30 additions & 0 deletions
30
schema/draft/examples/Tool/tool-with-array-output-schema.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "name": "list_users", | ||
| "title": "User List", | ||
| "description": "Returns a list of all users", | ||
| "inputSchema": { | ||
| "type": "object", | ||
| "properties": {} | ||
| }, | ||
| "outputSchema": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "description": "User ID" | ||
| }, | ||
| "name": { | ||
| "type": "string", | ||
| "description": "User name" | ||
| }, | ||
| "email": { | ||
| "type": "string", | ||
| "description": "User email" | ||
| } | ||
| }, | ||
| "required": ["id", "name", "email"] | ||
| } | ||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
schema/draft/examples/Tool/tool-with-composition-input-schema.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "name": "find_resource", | ||
| "title": "Resource Finder", | ||
| "description": "Find a resource by ID or name", | ||
| "inputSchema": { | ||
| "type": "object", | ||
| "oneOf": [ | ||
|
localden marked this conversation as resolved.
|
||
| { | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "description": "Resource ID" | ||
| } | ||
| }, | ||
| "required": ["id"] | ||
| }, | ||
| { | ||
| "properties": { | ||
| "name": { | ||
| "type": "string", | ||
| "description": "Resource name" | ||
| } | ||
| }, | ||
| "required": ["name"] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note - example is deliberately aligned with this clarification of content vs structured content audience and format.