Tool calls as quiet lines: the tool, what it did in plain words, a live timer and the status. Fold one open for the arguments and the result, copy either, and retry a failure in place. A group sums up a turn's calls in one line.
On this page
- Show one tool call
- Debug a failed call
- Retry a call
- Group calls in a reply
- Inspect arguments and result
Examples
States
Standalone card
Installation
npx knowns-ui@latest add tool-call-cardPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Tool call card from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/tool-call-card
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add tool-call-card
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/icons/actor-icon.tsx
- lib/knowns/icons/model-icons.tsx
- lib/knowns/icons/tool-icons.tsx
- lib/knowns/icons/model-icons.data.ts
- lib/knowns/icons/tool-icons.data.ts
- lib/knowns/icons/LICENSES.md
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/code-block/code-block.tsx
- components/ui/knowns/code-block/code-block-utils.ts
- components/ui/knowns/tool-call-card/tool-call-card.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/tool-call-card, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "tool-call-card" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- span
Span- The call: from, to, startedAt, endedAt?, outcome?, summary?, input?, output?, error?. No outcome means it is running.
- run + spanId
AgentRun + string- Follow a call in a run; updates as it finishes.
- actors
Actor[]- Default
[] - Names and icons when no run is given. The called tool's label is the mono name and picks the logo.
- variant
"line"|"card"- Default
"line" - line: one row that folds open, for chat threads and lists. card: standalone, with who called whom on top and the details open.
- name / icon
string / ReactNode- Default
tool label / logo - Override the mono tool name or the 16px icon (a wrench when nothing matches).
- open / defaultOpen / onOpenChange
boolean- Default
open on failure - Fold state. Uncontrolled lines open by themselves when the call fails; cards are open.
- onRetry
(span) => void- Shows Retry next to the error on failed calls.
- maxHeight
number- Default
220 - Arguments and result taller than this (px) are capped with a fade and Show more.
- now
number- Default
ticks - Fixes the clock (tests, screenshots). By default the timer ticks while the call runs.
| Prop | Type | Default | Description |
|---|---|---|---|
| span | Span | - | The call: from, to, startedAt, endedAt?, outcome?, summary?, input?, output?, error?. No outcome means it is running. |
| run + spanId | AgentRun + string | - | Follow a call in a run; updates as it finishes. |
| actors | Actor[] | [] | Names and icons when no run is given. The called tool's label is the mono name and picks the logo. |
| variant | "line" | "card" | "line" | line: one row that folds open, for chat threads and lists. card: standalone, with who called whom on top and the details open. |
| name / icon | string / ReactNode | tool label / logo | Override the mono tool name or the 16px icon (a wrench when nothing matches). |
| open / defaultOpen / onOpenChange | boolean | open on failure | Fold state. Uncontrolled lines open by themselves when the call fails; cards are open. |
| onRetry | (span) => void | - | Shows Retry next to the error on failed calls. |
| maxHeight | number | 220 | Arguments and result taller than this (px) are capped with a fade and Show more. |
| now | number | ticks | Fixes the clock (tests, screenshots). By default the timer ticks while the call runs. |
- ToolCallGroup · spans / run + spanIds
Span[] / AgentRun- The calls of one turn, in order. With a run, all its spans unless spanIds picks some.
- ToolCallGroup · label
ReactNode- Default
Used N tools · … - Header once nothing runs. The default sums up count, failures and wall time ("Used 3 tools · 1 failed · 2.6s"); while running it reads "Using 3 tools · 1 of 3 done".
- ToolCallGroup · open / defaultOpen / onOpenChange
boolean- Default
open on failure - Folds the rows. A failure opens the group and the failed row.
- ToolCallGroup · onRetry / maxHeight / now
-- Passed to every row.
- a11y
buttons, alert- Every line is a button with aria-expanded and aria-controls; status is named (Running, Done, Failed); errors are role=alert; the group's summary is announced politely when the turn ends.
| Prop | Type | Default | Description |
|---|---|---|---|
| ToolCallGroup · spans / run + spanIds | Span[] / AgentRun | - | The calls of one turn, in order. With a run, all its spans unless spanIds picks some. |
| ToolCallGroup · label | ReactNode | Used N tools · … | Header once nothing runs. The default sums up count, failures and wall time ("Used 3 tools · 1 failed · 2.6s"); while running it reads "Using 3 tools · 1 of 3 done". |
| ToolCallGroup · open / defaultOpen / onOpenChange | boolean | open on failure | Folds the rows. A failure opens the group and the failed row. |
| ToolCallGroup · onRetry / maxHeight / now | - | - | Passed to every row. |
| a11y | buttons, alert | - | Every line is a button with aria-expanded and aria-controls; status is named (Running, Done, Failed); errors are role=alert; the group's summary is announced politely when the turn ends. |
What it handles
- 01Reads one call from a span prop, or from a run by spanId, and shows the tool name, a timer and a status of running, success or failure.
- 02Folds open to the arguments and result as highlighted JSON, each with copy, and caps long values at maxHeight with a Show more button.
- 03Opens a failed call by itself, shows its error text, and puts a Retry link beside it when you pass onRetry.
- 04Counts whole seconds while a call runs and shows the exact time, such as 2.7s or 420ms, once it ends.
- 05Switches to variant="card" for a standalone view that is always open and names who called whom.
- 06Sums several calls in ToolCallGroup as one line like "Used 3 tools, 1 failed, 2.7s" that folds open to the calls.
States
- First render
- Nothing. The status mark and fold paint as they are
- none
- Call succeeds
- The check draws itself
- 180ms, ease out
- Call fails
- The icon shakes once and the X draws
- 280ms, ease out
- Fold opens
- The detail grows from the row
- 180ms, ease out
- Fold closes
- The detail shrinks away
- 120ms, ease out
- Chevron turns
- It rotates a quarter turn
- 180ms, ease in-out
- Row hover
- The background tints
- 120ms, ease out
- Reduced motion
- The check, shake, fold and chevron do not animate
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. The status mark and fold paint as they are | none |
| Call succeeds | The check draws itself | 180ms, ease out |
| Call fails | The icon shakes once and the X draws | 280ms, ease out |
| Fold opens | The detail grows from the row | 180ms, ease out |
| Fold closes | The detail shrinks away | 120ms, ease out |
| Chevron turns | It rotates a quarter turn | 180ms, ease in-out |
| Row hover | The background tints | 120ms, ease out |
| Reduced motion | The check, shake, fold and chevron do not animate | 0ms |
Works with
When to use
When to use
- Tool calls inside a chat thread: one quiet line each, or a group that sums up the turn, folding open to arguments and result.
- Letting the user retry a single failed call where it happened.
- A details panel for one call (variant="card"), with who called whom.
When not to use
- Many calls in sequence where timing matters: use Trace Waterfall.
- Steps the agent takes before it answers in a chat: use Thinking State.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Tool Call Card to my app and wire it to my own data.
- I need tool calls inside a chat thread: one quiet line each, or a group that sums up the turn, folding open to arguments and result. Set that up with the Knowns UI Tool Call Card.
- Which Tool Call Card props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "tool-call-card" }) and search_docs({ query: "tool call card" }).