pub struct CallToolResult {
pub result_type: ResultType,
pub content: Vec<ContentBlock>,
pub is_error: Option<bool>,
pub structured_content: Option<Value>,
pub meta: Option<ResultMetaObject>,
}Expand description
Result for tools/call — extends Result.
Note on structuredContent: 2026-07-28 widens this from object-only
(2025-11-25) to any JSON value (unknown). The field is typed Option<Value>
here — arrays, scalars, and null are now accepted.
Fields§
§result_type: ResultTypeDiscriminator per Result.resultType.
Complete for normal results; clients receiving an input_required value
should parse the message as InputRequiredResult instead via the
CallToolResultResponse.result union.
content: Vec<ContentBlock>Content returned by the tool.
is_error: Option<bool>Whether the tool call resulted in an error.
structured_content: Option<Value>Structured content (any JSON value per 2026-07-28; was object-only in 2025-11-25).
meta: Option<ResultMetaObject>Meta information (follows MCP Result interface).
Implementations§
Source§impl CallToolResult
impl CallToolResult
pub fn new(content: Vec<ContentBlock>) -> CallToolResult
pub fn success(content: Vec<ContentBlock>) -> CallToolResult
pub fn error(content: Vec<ContentBlock>) -> CallToolResult
pub fn with_error_flag(self, is_error: bool) -> CallToolResult
pub fn with_structured_content( self, structured_content: Value, ) -> CallToolResult
pub fn with_meta(self, meta: impl Into<ResultMetaObject>) -> CallToolResult
Sourcepub fn from_result<T>(result: &T) -> Result<CallToolResult, McpError>where
T: Serialize,
pub fn from_result<T>(result: &T) -> Result<CallToolResult, McpError>where
T: Serialize,
Create response from serializable result with optional structured content
Sourcepub fn from_result_with_structured<T>(
result: &T,
) -> Result<CallToolResult, McpError>where
T: Serialize,
pub fn from_result_with_structured<T>(
result: &T,
) -> Result<CallToolResult, McpError>where
T: Serialize,
Create response with both text and structured content
Sourcepub fn from_result_with_schema<T>(
result: &T,
schema: Option<&ToolSchema>,
) -> Result<CallToolResult, McpError>where
T: Serialize,
pub fn from_result_with_schema<T>(
result: &T,
schema: Option<&ToolSchema>,
) -> Result<CallToolResult, McpError>where
T: Serialize,
Create response from serializable result with automatic structured content based on schema
Sourcepub fn from_result_auto<T>(
result: &T,
schema: Option<&ToolSchema>,
) -> Result<CallToolResult, McpError>where
T: Serialize,
pub fn from_result_auto<T>(
result: &T,
schema: Option<&ToolSchema>,
) -> Result<CallToolResult, McpError>where
T: Serialize,
Create response with automatic structured content for primitives (zero-config)
Sourcepub fn from_json_with_schema(
json_result: Value,
schema: Option<&ToolSchema>,
) -> CallToolResult
pub fn from_json_with_schema( json_result: Value, schema: Option<&ToolSchema>, ) -> CallToolResult
Create response from JSON value with automatic structured content
Trait Implementations§
Source§impl CallToolResult for CallToolResult
impl CallToolResult for CallToolResult
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