Skip to main content

Module tool_call

Module tool_call 

Source
Expand description

One invocation of one tool: what was called, with what, what came back, and how long it took.

§A refusal is not an absence and not an error

Five states, five renderings, and one published name each. A host that declined to run a tool made a decision, so ToolCallState::Refused carries the host’s reason and reads as a decision. It is not ToolCallState::Failed, which blames the tool for something it did; and it is not ToolOutput::Silent, which claims the tool ran and returned nothing. A card that rendered any of those three the same way would be telling the reader something nobody established.

§Nothing here is this crate’s data

Arguments, results, errors and refusal reasons are the caller’s, may be long, and may be secret. So a ToolBody publishes its shape — how many lines it holds, and how many of them are on screen — and never its text, the rule DescriptionValue::Redacted already keeps. Truncation is stated in the same words it publishes: a body cut to three of twelve lines says so where the cut happens, rather than fading out and leaving the reader to guess how much is missing.

An elapsed time is a string the caller already wrote, for the reason Timeline takes one: turning a duration into words is locale work this crate does not do.

Structs§

ToolBody
A block of caller-owned text — the arguments a tool was called with, or what it returned — with an optional limit on how much of it is drawn.
ToolCallCard
One tool invocation, in whichever of its five states holds.

Enums§

Elapsed
How long a call took, as far as anyone has said.
ToolCallState
Where one invocation has got to.
ToolOutput
What a tool that ran to completion gave back.