pub struct ToolCallResult {
pub content: Vec<ContentItem>,
pub is_error: Option<bool>,
}Expand description
What a tools/call returns: the text a model will read.
Every handler in crate::context produces one of these, and the
renderers in crate::render decide what goes in it — the text IS
the API (each experiment-pool result ends with a next: line and
carries its run_dir:), so this type stays a thin envelope.
Fields§
§content: Vec<ContentItem>The content items, concatenated by content_text when a
caller wants the single string a model sees.
is_error: Option<bool>Some(true) when the tool failed. MCP keeps tool failure inside
a successful response — the model reads the error text and can
react to it, unlike a protocol-level JsonRpcError.
Implementations§
Source§impl ToolCallResult
impl ToolCallResult
Sourcepub fn error(s: impl Into<String>) -> Self
pub fn error(s: impl Into<String>) -> Self
A failed result: the same text block, flagged isError so the
model knows it is reading a failure, not an answer.
Sourcepub fn content_text(&self) -> String
pub fn content_text(&self) -> String
The text a model would see — every content item concatenated. The protocol carries text, so this is the whole result.