pub struct ToolResult {
pub kind: String,
pub command_id: String,
pub run_stream: StreamRef,
pub call_id: String,
pub text: String,
pub correlation_facts: Option<Value>,
pub edit_facts: Option<Value>,
pub extra: Map<String, Value>,
}Expand description
tool.result — outcome of one tool invocation (live providers only).
No task_id, but the wire models each tool call as its own task
(task_kind: tool.<tool_name>) and correlation_facts.tool_name
names it — match on that, latest-first. Recency-of-running-tasks
heuristics mis-attribute: the issuing tool task has already completed
when this record lands. call_id is the provider’s call id, not a
task handle — see the README’s known-wire-gaps section.
correlation_facts is absent on some tool results (e.g. compact bash
results like {"items":5,"ok":true,"revision":4} observed on
3035c77c-efca...).
text is opaque for most tools (prose, e.g. write_file → "wrote 6 bytes …"),
but the bash/command tool packs a structured JSON object into text
(see CommandResult). Use ToolResult::command_result to get a typed
view when that shape is present. The same JSON is also emitted as a
task.lifecycle.output chunk — consumers that render both channels should
de-dupe (the tool.result record is authoritative).
Fields§
§kind: String§command_id: String§run_stream: StreamRef§call_id: StringProvider call id this result answers.
text: StringResult text as shown to the model (including failure prose).
For the bash/command tool this is a JSON string of a CommandResult;
see ToolResult::command_result and ToolResult::try_command_result.
correlation_facts: Option<Value>Correlation summary — observed {outcome, tool_name}, open-shaped.
Absent on some results; treat as None when missing.
edit_facts: Option<Value>Populated for file-editing tools; open-shaped.
extra: Map<String, Value>Implementations§
Source§impl ToolResult
impl ToolResult
Sourcepub fn is_command_tool(&self) -> bool
pub fn is_command_tool(&self) -> bool
Whether this result came from the bash/command tool, via
correlation_facts.tool_name == "bash" | "command".
Sourcepub fn command_result(&self) -> Option<CommandResult>
pub fn command_result(&self) -> Option<CommandResult>
Try to parse text as a structured CommandResult (the bash tool
shape described in #294). Returns None if text is not valid JSON
for that shape. Checks is_command_tool() first but also accepts any
JSON object that deserializes as CommandResult — so compact results
without correlation_facts (observed on #299) still parse.
Sourcepub fn try_command_result(&self) -> Result<CommandResult, Error>
pub fn try_command_result(&self) -> Result<CommandResult, Error>
Fallible parse of text as CommandResult, preserving the serde error.
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