Skip to content

Molecules · Tool call

Tool call

A tool the assistant ran, shown right where it ran. It has the status as a word and a small symbol, a title, the tool name and how long it took, with the input and output folded away behind a button.

Best for
An assistant reply that ran a tool, such as a query, a lookup or a calculation.
Not for
An action with side effects that needs a yes first: use ApprovalRequest.

This page as Markdown, a plain-text copy for a coding agent (an AI tool that writes code).

Examples

Running, done and failed

Read stock levels at Depot 4

query_stock_levels

Running

Read stock levels at Depot 4

query_stock_levels

Done1.2 s

Check supplier lead times

fetch_supplier_lead_times

Failed4.0 s
Code
tsx
<div className="flex w-full max-w-xl flex-col gap-3">  <ToolCall name="query_stock_levels" title="Read stock levels at Depot 4" status="running" />  <ToolCall    name="query_stock_levels"    title="Read stock levels at Depot 4"    status="done"    duration="1.2 s"    input={'{ "depot": 4, "below_reorder_point": true }'}    output={'[\n  { "sku": "K-41", "on_hand": 6, "reorder_at": 10 },\n  { "sku": "TP-08", "on_hand": 3, "reorder_at": 8 }\n]'}  />  <ToolCall    name="fetch_supplier_lead_times"    title="Check supplier lead times"    status="failed"    duration="4.0 s"    output="Timed out after 4 s. The supplier feed did not answer."  /></div>

Without a title, details open

count_pallets

Done0.3 s

Input

{ "depot": 4, "bay": 2 }

Output

14 pallets
Code
tsx
<div className="flex w-full max-w-xl flex-col gap-3">  <ToolCall    name="count_pallets"    status="done"    duration="0.3 s"    input={'{ "depot": 4, "bay": 2 }'}    output="14 pallets"    defaultOpen  /></div>

Anatomy

PartWhat it is
PanelA thin frame on surface.raised. It's marked as a separate block, so the message's screen reader announcement skips it.
Status glyphA Spinner while running, a check when done, an alert circle when failed. Decoration only.
Title and nameThe title written for people, then the tool's own name in a monospaced font. With no title, the name comes first.
Status badgeRunning, Done or Failed as a word in the tone's colour. Colour is never the only signal.
DurationIn a monospaced font with equal-width digits, for example "1.2 s".
DetailsA "Show details" button (with aria-expanded, which tells screen readers whether it's open) above Input and Output. Those wrap onto new lines instead of scrolling sideways.

Props

namestring
Required. The tool's own name, shown in a monospaced font.
titlestring
A plain-language description of the call, shown above the name.
status'running' | 'done' | 'failed'
Required. Shown as a word, a symbol and a colour.
durationstring
How long it took, for example "1.2 s".
inputReactNode
What the assistant sent the tool. Folded away by default.
outputReactNode
What came back. Folded away by default.
defaultOpenbooleanDefault false
Starts with the details showing.
classNamestring
Added to the panel.

Keyboard

KeysResult
TabMoves to "Show details".
EnterSpaceShows or hides the input and output.

Do and don't

Do

  • Give each call a title a person understands: "Read stock levels at Depot 4", not just the function name.
  • Show the call even when it's boring. Seeing the work is how a reader learns to trust it, or to catch a mistake.
  • Mention a failure in the reply text too, along with what the assistant did instead.

Don't

  • Don't give a call its own live region (an area screen readers announce on change). The thread's busy status speaks for the whole turn.
  • Don't open the details by default for long payloads. The reply is what matters, and the payload is the evidence.
  • Don't use a ToolCall for something with a side effect the person hasn't agreed to. Ask with ApprovalRequest first.