pub struct ToolResultContent {
pub content: Vec<ContentBlock>,
pub is_error: Option<bool>,
pub meta: Option<Map<String, Value>>,
pub structured_content: Option<Map<String, Value>>,
pub tool_use_id: String,
/* private fields */
}Expand description
The result of a tool use, provided by the user back to the assistant.
JSON schema
{
"description": "The result of a tool use, provided by the user back to the assistant.",
"type": "object",
"required": [
"content",
"toolUseId",
"type"
],
"properties": {
"_meta": {
"description": "Optional metadata about the tool result. Clients SHOULD preserve this field when\nincluding tool results in subsequent sampling requests to enable caching optimizations.\n\nSee [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
"type": "object",
"additionalProperties": {}
},
"content": {
"description": "The unstructured result content of the tool use.\n\nThis has the same format as CallToolResult.content and can include text, images,\naudio, resource links, and embedded resources.",
"type": "array",
"items": {
"$ref": "#/$defs/ContentBlock"
}
},
"isError": {
"description": "Whether the tool use resulted in an error.\n\nIf true, the content typically describes the error that occurred.\nDefault: false",
"type": "boolean"
},
"structuredContent": {
"description": "An optional structured result object.\n\nIf the tool defined an outputSchema, this SHOULD conform to that schema.",
"type": "object",
"additionalProperties": {}
},
"toolUseId": {
"description": "The ID of the tool use this result corresponds to.\n\nThis MUST match the ID from a previous ToolUseContent.",
"type": "string"
},
"type": {
"type": "string",
"const": "tool_result"
}
}
}Fields§
§content: Vec<ContentBlock>The unstructured result content of the tool use. This has the same format as CallToolResult.content and can include text, images, audio, resource links, and embedded resources.
is_error: Option<bool>Whether the tool use resulted in an error. If true, the content typically describes the error that occurred. Default: false
meta: Option<Map<String, Value>>Optional metadata about the tool result. Clients SHOULD preserve this field when including tool results in subsequent sampling requests to enable caching optimizations. See General fields: _meta for notes on _meta usage.
structured_content: Option<Map<String, Value>>An optional structured result object. If the tool defined an outputSchema, this SHOULD conform to that schema.
tool_use_id: StringThe ID of the tool use this result corresponds to. This MUST match the ID from a previous ToolUseContent.
Implementations§
Source§impl ToolResultContent
impl ToolResultContent
pub fn new( content: Vec<ContentBlock>, tool_use_id: String, is_error: Option<bool>, meta: Option<Map<String, Value>>, structured_content: Option<Map<String, Value>>, ) -> Self
pub fn type_(&self) -> &String
Sourcepub fn type_value() -> String
pub fn type_value() -> String
returns “tool_result”
pub fn type_name() -> String
type_value() instead.Trait Implementations§
Source§impl Clone for ToolResultContent
impl Clone for ToolResultContent
Source§fn clone(&self) -> ToolResultContent
fn clone(&self) -> ToolResultContent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more