Tool call
One call an agent made to a tool: what it sent, what came back, how it went, and Retry when it failed.
Installation
npm i @uisatin/uiimport { ToolCall } from '@uisatin/ui/tool-call'About 21.3 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.
npx shadcn@latest add https://uisatin.dev/r/tool-call.jsonAdds tool-call.tsx, button.tsx, code-block.tsx, labels.tsx and spinner.tsx to components/ui and installs iconoir-react.
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The ToolCall component is a card whose header is a button (aria-expanded, aria-controls) with the tool, its target and the status; it opens onto the input and the output, as JSON in CodeBlocks or as nodes of your own, cut at maxLines with Show all. A failed call opens on its own, with the error and Retry. The parts it is made of, ToolCallRoot, ToolCallHeader, ToolCallContent, ToolCallSection and ToolCallError, build anything else.
| Prop | Type | Default |
|---|---|---|
name | ReactNode | — |
status | "pending""running""success""error""cancelled" | — |
icon | ReactNode | <Tools /> |
target | ReactNode | — |
input | ToolCallValue | — |
output | ToolCallValue | — |
error | ReactNode | — |
onRetry | () => void | — |
duration | number | — |
startedAt | Datenumber | — |
maxLines | number | 10 |
open | boolean | — |
defaultOpen | boolean | status === "error" |
onOpenChange | (open: boolean) => void | — |
Accessibility
The header is a button with aria-expanded and aria-controls, named by the tool, its target and the status ("Find slots calendar.findSlots Running"); the clock that ticks while it runs is hidden. Folded, the body stays mounted but leaves the tab order and screen readers. Each section is named after the tool ("Find slots Input code"), so two cards’ code never shares a name. A call that ends while the card is on screen is read out politely ("Find slots Failed"); Retry hands focus back to the header, since it leaves with the error.
| Key | Action |
|---|---|
| EnterorSpace | On the header: opens or folds the card. |
| Tab | Open, moves through each section’s Copy and code, Show all, and Retry. |
| ←or→ | Scrolls long lines while a section’s code has focus. |
Something wrong or missing on this page?
Report a problemSuggest an improvement