pub struct CallToolResult {
pub meta: Option<ResultMetaObject>,
pub content: Vec<ContentBlock>,
pub is_error: Option<bool>,
pub result_type: String,
pub structured_content: Option<Value>,
}Expand description
The result returned by the server for a CallToolRequesttools/call request.
Fields§
§meta: Option<ResultMetaObject>§content: Vec<ContentBlock>A list of content objects that represent the unstructured result of the tool call.
is_error: Option<bool>Whether the tool call ended in an error.
If not set, this is assumed to be false (the call was successful).
Any errors that originate from the tool SHOULD be reported inside the result
object, with isError set to true, not as an MCP protocol-level error
response. Otherwise, the LLM would not be able to see that an error occurred
and self-correct.
However, any errors in finding the tool, an error indicating that the server does not support tool calls, or any other exceptional conditions, should be reported as an MCP error response.
result_type: StringIndicates the type of the result, which allows the client to determine how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".
structured_content: Option<Value>An optional JSON value that represents the structured result of the tool call.
This can be any JSON value (object, array, string, number, boolean, or null) that conforms to the tool’s outputSchema if one is defined.
Implementations§
Source§impl CallToolResult
impl CallToolResult
Sourcepub fn new(content: Vec<ContentBlock>, result_type: String) -> CallToolResult
pub fn new(content: Vec<ContentBlock>, result_type: String) -> CallToolResult
Creates a value from its required fields; optional fields are None.
Trait Implementations§
Source§impl Clone for CallToolResult
impl Clone for CallToolResult
Source§fn clone(&self) -> CallToolResult
fn clone(&self) -> CallToolResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more