pub struct ToolResult {
pub content: Vec<ToolResultBlock>,
pub is_error: bool,
pub details: Value,
pub terminate: bool,
pub narration: Option<String>,
}Expand description
Result of a tool execution.
Always contains content blocks visible to the model. details is
arbitrary structured metadata for logs / UI / replay; the model never
sees it directly. terminate is the unanimous-vote signal.
narration is an optional row-caption sentence shown to the user.
It is owned by the tool (or a product-level after-hook) and should
be derived from typed tool state such as path, query, exit code, or
byte count. The generic loop does not infer narration from private
model deliberation.
Fields§
§content: Vec<ToolResultBlock>§is_error: bool§details: Value§terminate: bool§narration: Option<String>Implementations§
Source§impl ToolResult
impl ToolResult
Sourcepub fn terminal(text: impl Into<String>) -> Self
pub fn terminal(text: impl Into<String>) -> Self
Convenience: a plain-text terminal result (vote to end the run).
Sourcepub fn error(text: impl Into<String>) -> Self
pub fn error(text: impl Into<String>) -> Self
Convenience: an error result. The loop treats this as a context event, not a fatal — the model can recover.
Sourcepub fn with_narration(self, narration: impl Into<String>) -> Self
pub fn with_narration(self, narration: impl Into<String>) -> Self
Attach a one-sentence diary entry in the user’s voice. Whitespace-only input is dropped to keep the diary clean. Trims surrounding whitespace so call sites can hand in templated multi-line strings.
Trait Implementations§
Source§impl Clone for ToolResult
impl Clone for ToolResult
Source§fn clone(&self) -> ToolResult
fn clone(&self) -> ToolResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more