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

View file

@ -2697,6 +2697,7 @@ pub type ElicitationCompletionNotification =
#[non_exhaustive]
pub struct CallToolResult {
/// The content returned by the tool (text, images, etc.)
#[serde(default)]
pub content: Vec<Content>,
/// An optional JSON object that represents the structured result of the tool call
#[serde(skip_serializing_if = "Option::is_none")]
@ -3247,16 +3248,16 @@ ts_union!(
| ListResourcesResult
| ListResourceTemplatesResult
| ReadResourceResult
| CallToolResult
| ListToolsResult
| CreateElicitationResult
| EmptyResult
| CreateTaskResult
| ListTasksResult
| GetTaskResult
| CancelTaskResult
| CustomResult
| CallToolResult
| GetTaskPayloadResult
| EmptyResult
| CustomResult
;
);