FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(schema): close oneOf type-check bypass and render SEP-2106 Tool examples by olaservo · Pull Request #3185 · modelcontextprotocol/modelcontextprotocol · GitHub

Repository navigation

Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .json  (4) .mdx  (2) .ts  (2) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
7 changes: 5 additions & 2 deletions docs/specification/2026-07-28/schema.mdx

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions docs/specification/draft/schema.mdx

Large diffs are not rendered by default.

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
Expand Up @@ -4,25 +4,16 @@
"description": "Find a resource by ID or name",
"inputSchema": {
"type": "object",
"oneOf": [
{
"properties": {
"id": {
"type": "string",
"description": "Resource ID"
}
},
"required": ["id"]
"properties": {
"id": {
"type": "string",
"description": "Resource ID"
},
{
"properties": {
"name": {
"type": "string",
"description": "Resource name"
}
},
"required": ["name"]
"name": {
"type": "string",
"description": "Resource name"
}
]
},
"oneOf": [{ "required": ["id"] }, { "required": ["name"] }]
}
}
2 changes: 1 addition & 1 deletion schema/2026-07-28/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions schema/2026-07-28/schema.ts
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
Expand Up @@ -1965,9 +1965,15 @@ export interface ToolAnnotations {
* @example With no parameters
* {@includeCode ./examples/Tool/with-no-parameters.json}
*
* @example With a composition input schema
* {@includeCode ./examples/Tool/tool-with-composition-input-schema.json}
*
* @example With output schema for structured content
* {@includeCode ./examples/Tool/with-output-schema-for-structured-content.json}
*
* @example With an array output schema
* {@includeCode ./examples/Tool/tool-with-array-output-schema.json}
Comment thread
olaservo marked this conversation as resolved.
*
* @category `tools/list`
*/
export interface Tool extends BaseMetadata, Icons {
Expand All @@ -1987,6 +1993,11 @@ export interface Tool extends BaseMetadata, Icons {
* (`if`/`then`/`else`), reference keywords (`$ref`, `$defs`, `$anchor`), and any other
* standard validation or annotation keywords.
*
* When using composition keywords, declare `properties` at the schema root and keep the
* branches to presence assertions such as `required`. A subschema that fails on a type
* error is indistinguishable from one that does not apply, so type constraints placed
* inside `oneOf` branches are not enforced for whichever branch does not match.
*
* Property schemas may carry an `x-mcp-header` annotation to mirror the
* argument value into an HTTP header on the Streamable HTTP transport. See
* the Streamable HTTP transport specification for the validity and
Expand Down
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
Expand Up @@ -4,25 +4,16 @@
"description": "Find a resource by ID or name",
"inputSchema": {
"type": "object",
"oneOf": [
{
"properties": {
"id": {
"type": "string",
"description": "Resource ID"
}
},
"required": ["id"]
"properties": {
"id": {
"type": "string",
"description": "Resource ID"
},
{
"properties": {
"name": {
"type": "string",
"description": "Resource name"
}
},
"required": ["name"]
"name": {
"type": "string",
"description": "Resource name"
}
]
},
"oneOf": [{ "required": ["id"] }, { "required": ["name"] }]
}
}
2 changes: 1 addition & 1 deletion schema/draft/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions schema/draft/schema.ts
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
Expand Up @@ -1965,9 +1965,15 @@ export interface ToolAnnotations {
* @example With no parameters
* {@includeCode ./examples/Tool/with-no-parameters.json}
*
* @example With a composition input schema
* {@includeCode ./examples/Tool/tool-with-composition-input-schema.json}
*
* @example With output schema for structured content
* {@includeCode ./examples/Tool/with-output-schema-for-structured-content.json}
*
* @example With an array output schema
* {@includeCode ./examples/Tool/tool-with-array-output-schema.json}
Comment thread
olaservo marked this conversation as resolved.
*
* @category `tools/list`
*/
export interface Tool extends BaseMetadata, Icons {
Expand All @@ -1987,6 +1993,11 @@ export interface Tool extends BaseMetadata, Icons {
* (`if`/`then`/`else`), reference keywords (`$ref`, `$defs`, `$anchor`), and any other
* standard validation or annotation keywords.
*
* When using composition keywords, declare `properties` at the schema root and keep the
* branches to presence assertions such as `required`. A subschema that fails on a type
* error is indistinguishable from one that does not apply, so type constraints placed
* inside `oneOf` branches are not enforced for whichever branch does not match.
*
* Property schemas may carry an `x-mcp-header` annotation to mirror the
* argument value into an HTTP header on the Streamable HTTP transport. See
* the Streamable HTTP transport specification for the validity and
Expand Down
Loading

Back | FazBrowse Home | New Git URL