fix: default CallToolResult content to empty vec on missing field (#752)

This commit is contained in:
Dale Seo 2026-03-13 16:02:20 -04:00 • committed by GitHub
commit 44dfcf5550
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 42 additions and 33 deletions

View file

@ -388,6 +388,7 @@
"content": {
"description": "The content returned by the tool (text, images, etc.)",
"type": "array",
"default": [],
"items": {
"$ref": "#/definitions/Annotated"
}
@ -402,10 +403,7 @@
"structuredContent": {
"description": "An optional JSON object that represents the structured result of the tool call"
}
},
"required": [
"content"
]
}
},
"CancelTaskResult": {
"description": "Response to a `tasks/cancel` request.\n\nPer spec, `CancelTaskResult = allOf[Result, Task]` — same shape as `GetTaskResult`.",
@ -2813,18 +2811,12 @@
{
"$ref": "#/definitions/ReadResourceResult"
},
{
"$ref": "#/definitions/CallToolResult"
},
{
"$ref": "#/definitions/ListToolsResult"
},
{
"$ref": "#/definitions/CreateElicitationResult"
},
{
"$ref": "#/definitions/EmptyObject"
},
{
"$ref": "#/definitions/CreateTaskResult"
},
@ -2838,10 +2830,16 @@
"$ref": "#/definitions/CancelTaskResult"
},
{
"$ref": "#/definitions/CustomResult"
"$ref": "#/definitions/CallToolResult"
},
{
"$ref": "#/definitions/GetTaskPayloadResult"
},
{
"$ref": "#/definitions/EmptyObject"
},
{
"$ref": "#/definitions/CustomResult"
}
]
},

View file

@ -388,6 +388,7 @@
"content": {
"description": "The content returned by the tool (text, images, etc.)",
"type": "array",
"default": [],
"items": {
"$ref": "#/definitions/Annotated"
}
@ -402,10 +403,7 @@
"structuredContent": {
"description": "An optional JSON object that represents the structured result of the tool call"
}
},
"required": [
"content"
]
}
},
"CancelTaskResult": {
"description": "Response to a `tasks/cancel` request.\n\nPer spec, `CancelTaskResult = allOf[Result, Task]` — same shape as `GetTaskResult`.",
@ -2813,18 +2811,12 @@
{
"$ref": "#/definitions/ReadResourceResult"
},
{
"$ref": "#/definitions/CallToolResult"
},
{
"$ref": "#/definitions/ListToolsResult"
},
{
"$ref": "#/definitions/CreateElicitationResult"
},
{
"$ref": "#/definitions/EmptyObject"
},
{
"$ref": "#/definitions/CreateTaskResult"
},
@ -2838,10 +2830,16 @@
"$ref": "#/definitions/CancelTaskResult"
},
{
"$ref": "#/definitions/CustomResult"
"$ref": "#/definitions/CallToolResult"
},
{
"$ref": "#/definitions/GetTaskPayloadResult"
},
{
"$ref": "#/definitions/EmptyObject"
},
{
"$ref": "#/definitions/CustomResult"
}
]
},