Skip to content

Commit 3addaff

Browse files
authored
Merge pull request modelcontextprotocol#519 from modelcontextprotocol/basil/tighten_output_schema
Tighten Tool.outputSchema
2 parents 4929efa + c2e0fd6 commit 3addaff

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

schema/draft/schema.json

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,9 +2128,30 @@
21282128
"type": "string"
21292129
},
21302130
"outputSchema": {
2131-
"additionalProperties": true,
21322131
"description": "An optional JSON Schema object defining the structure of the tool's output.\n\nIf set, a CallToolResult for this Tool MUST contain a structuredContent field whose contents validate against this schema.\nIf not set, a CallToolResult for this Tool MUST contain a content field.",
2133-
"properties": {},
2132+
"properties": {
2133+
"properties": {
2134+
"additionalProperties": {
2135+
"additionalProperties": true,
2136+
"properties": {},
2137+
"type": "object"
2138+
},
2139+
"type": "object"
2140+
},
2141+
"required": {
2142+
"items": {
2143+
"type": "string"
2144+
},
2145+
"type": "array"
2146+
},
2147+
"type": {
2148+
"const": "object",
2149+
"type": "string"
2150+
}
2151+
},
2152+
"required": [
2153+
"type"
2154+
],
21342155
"type": "object"
21352156
}
21362157
},

schema/draft/schema.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,11 @@ export interface Tool {
853853
* If set, a CallToolResult for this Tool MUST contain a structuredContent field whose contents validate against this schema.
854854
* If not set, a CallToolResult for this Tool MUST contain a content field.
855855
*/
856-
outputSchema?: object;
856+
outputSchema?: {
857+
type: "object";
858+
properties?: { [key: string]: object };
859+
required?: string[];
860+
};
857861

858862
/**
859863
* Optional additional tool information.

0 commit comments

Comments
 (0)