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() -> &'static str
pub fn type_value() -> &'static str
returns “tool_result”
pub fn type_name() -> &'static str
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§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToolResultContent
impl Debug for ToolResultContent
Source§impl<'de> Deserialize<'de> for ToolResultContent
impl<'de> Deserialize<'de> for ToolResultContent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<ToolResultContent> for CreateMessageContent
impl From<ToolResultContent> for CreateMessageContent
Source§fn from(value: ToolResultContent) -> Self
fn from(value: ToolResultContent) -> Self
Source§impl From<ToolResultContent> for SamplingMessageContent
impl From<ToolResultContent> for SamplingMessageContent
Source§fn from(value: ToolResultContent) -> Self
fn from(value: ToolResultContent) -> Self
Source§impl From<ToolResultContent> for SamplingMessageContentBlock
impl From<ToolResultContent> for SamplingMessageContentBlock
Source§fn from(value: ToolResultContent) -> Self
fn from(value: ToolResultContent) -> Self
Auto Trait Implementations§
impl Freeze for ToolResultContent
impl RefUnwindSafe for ToolResultContent
impl Send for ToolResultContent
impl Sync for ToolResultContent
impl Unpin for ToolResultContent
impl UnwindSafe for ToolResultContent
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)