pub struct ToolAnswer {
pub text: String,
pub new_messages: Option<Vec<Value>>,
pub reported_failure: bool,
pub structured: Option<Value>,
pub file_changes: Vec<FileChange>,
}Expand description
A tool that ran, and what it produced.
reported_failure is not the same thing as the Err this rides beside.
Err is the engine failing to run a tool at all: it cancels the rest of a
concurrent batch and fires PostToolUseFailure. This is the tool running
exactly as designed and saying the work did not go well — a shell command
with a non-zero exit, an HTTP status a fetch will not follow, an MCP
server answering isError, a plugin whose guest trapped. The model has to
be able to tell those from an answer, which is what is_error on the wire
is for, and carrying the flag here is the only way it gets there: a
wrapper sits between the tool and the caller, so a shape with no room for
it drops it.
Fields§
§text: StringThe text the model sees.
new_messages: Option<Vec<Value>>Messages the tool asked to have injected.
reported_failure: boolThe tool ran and is calling its own result a failure.
structured: Option<Value>The result’s structured content, when the tool gave one.
file_changes: Vec<FileChange>The files the call wrote, for the host.