You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<Warning>For trust & safety and security, clients **MUST** consider
@@ -238,18 +238,13 @@ or data, behind a URI that can be subscribed to or fetched again by the client l
238
238
239
239
### Output Schema
240
240
241
-
The optional `outputSchema` property provides a JSON Schema that describes the expected structure of the tool's output. This schema applies to the `text` property of the TextContent object returned by the tool.
241
+
The optional `outputSchema` property provides a JSON Schema that describes the expected structure of the `structuredContent` property of a CallToolResult.
242
242
243
243
When a tool specifies an `outputSchema`:
244
244
245
-
1. Clients **SHOULD** validate that the tool's result:
246
-
- Contains exactly one content item
247
-
- This item is a `TextContent` object
248
-
- The `text` property of this object validates against the schema
245
+
1. Clients **MUST** validate that the tool result contains a `structuredContent` field whose contents validate against the declared `outputSchema`.
249
246
250
-
2. Servers **SHOULD**:
251
-
- Provide responses that conform to their declared schema
252
-
- Use proper JSON or structured formats in their responses when the schema specifies structured data
247
+
2. Servers **MUST** provide tool results that conform to their declared `outputSchema`s.
253
248
254
249
Example tool with output schema:
255
250
@@ -289,21 +284,19 @@ Example valid response for this tool:
289
284
"jsonrpc": "2.0",
290
285
"id": 5,
291
286
"result": {
292
-
"content": [
293
-
{
294
-
"type": "text",
295
-
"text": "[{\"id\":\"doc-1\",\"title\":\"Introduction to MCP\",\"url\":\"https://example.com/docs/1\"},{\"id\":\"doc-2\",\"title\":\"Tool Usage Guide\",\"url\":\"https://example.com/docs/2\"}]"
296
-
}
297
-
]
287
+
"structuredContent": {
288
+
"type": "text",
289
+
"text": "[{\"id\":\"doc-1\",\"title\":\"Introduction to MCP\",\"url\":\"https://example.com/docs/1\"},{\"id\":\"doc-2\",\"title\":\"Tool Usage Guide\",\"url\":\"https://example.com/docs/2\"}]"
290
+
}
298
291
}
299
292
}
300
293
```
301
294
302
-
The `outputSchema` helps clients and LLMs understand and properly handle tool outputs by:
295
+
The `outputSchema` helps clients and LLMs understand and properly handle structured tool outputs by:
303
296
304
-
- Enabling schema validation of responses
297
+
- Enabling strict schema validation of responses
305
298
- Providing type information for better integration with programming languages
306
-
- Guiding LLMs to properly parse and utilize the returned data
299
+
- Guiding clients and LLMs to properly parse and utilize the returned data
307
300
- Supporting better documentation and developer experience
Copy file name to clipboardExpand all lines: schema/draft/schema.json
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,7 @@
109
109
"type": "object"
110
110
},
111
111
"content": {
112
+
"description": "A list of content objects that represent the result of the tool call.",
112
113
"items": {
113
114
"anyOf": [
114
115
{
@@ -130,11 +131,12 @@
130
131
"isError": {
131
132
"description": "Whether the tool call ended in an error.\n\nIf not set, this is assumed to be false (the call was successful).",
132
133
"type": "boolean"
134
+
},
135
+
"structuredContent": {
136
+
"description": "If the Tool defines an outputSchema, this field MUST contain a serialized JSON object that matches the schema.",
137
+
"type": "string"
133
138
}
134
139
},
135
-
"required": [
136
-
"content"
137
-
],
138
140
"type": "object"
139
141
},
140
142
"CancelledNotification": {
@@ -2052,7 +2054,7 @@
2052
2054
},
2053
2055
"outputSchema": {
2054
2056
"additionalProperties": true,
2055
-
"description": "A JSON Schema object defining the structure of the tool's output.\n\nIf set, a client SHOULD validate a CallToolResult for this Tool as follows:\n1. check that the length of the result's `content` property == 1\n2. check that this single item is a `TextContent` object\n3. validate this object's `text` property against this schema.\n\nIn other words, for a CallToolResult to be valid with respect to this schema,\nit must first satisfy the precondition that its payload be a single TextContent \nobject.",
2057
+
"description": "A 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.",
0 commit comments