Skip to main content

Tool Call

Preview

One tool call of a chat answer, folded under a row with the tool's name and its state. Open it to read what the model sent the tool and what came back.

Desktop viewport
Tablet viewport
Mobile viewport

When to use

  • Show a tool that a model called while it answered, inside a chat message.
  • Use Reasoning for the reasoning the model wrote.
  • Prefer Accordion for titled sections that are not part of a chat answer.

States

status takes four values, and the row shows an icon and a word for each. A call is running until its result arrives, then done, or failed when the tool returned an error. Set interrupted when the answer ended, by a stop or a failure, before the result arrived.

Desktop viewport
Tablet viewport
Mobile viewport

Composition

ToolCall.Root├── ToolCall.Trigger│   └── ToolCall.Name└── ToolCall.Content

Polymorphism

ToolCall.Name takes asChild. The other parts do not: each renders more than one element, or an element beside its children.

Translation

ToolCall.Name sets translate="no", because a tool's name is an identifier. ToolCall.Trigger renders an icon, the state, and a caret beside its children. The children sit in a display: contents wrapper, data-slot="tool-call-trigger-label", so a page that a browser translates survives a change to them.

API Reference

ToolCall.Root

The tool call disclosure. It starts closed.

All props from div, plus:

PropTypeDefaultDescription
status"running" | "done" | "failed" | "interrupted"The state of the call. Required.
Data AttributeValueDescription
data-status"running", "done", "failed", "interrupted"The state of the call. Style with data-[status=failed]:.

ToolCall.Trigger

The disclosure row shows a state icon, its children, a state label, and a caret.

All props from button except type.

Data AttributeValueDescription
data-slot="tool-call-trigger-label"on the wrapperThe display: contents wrapper around the children.

ToolCall.Name

The tool's name in code type. It never translates.

All props from code except translate, plus:

PropTypeDefaultDescription
asChild?booleanfalseRender as a different element by passing a child.

ToolCall.Content

What the model sent the tool and what came back, such as two CodeBlocks. The children stack with a small gap.

All props from div.