Tools
Inline tool call rows and multi-call turn summaries for agent transcripts, with brand marks, structured outputs, approval, and retry.
import { ToolCall } from '@uthereal/ui/tool-call'Tool call playground
- repo
- acme/web
- query
- is:open label:release-blocker
- #1284Checkout button stays disabled after coupon removalcheckout
- #1291Webhook retry posts a second charge after a 504billing
- #1297Safari address autofill skips postal code validationsafari
Overview
ToolCall renders a single tool call row in an agent transcript: the tool's brand mark, a plain-language verb phrase, quiet metadata or inline decision controls, a status icon, and a collapsible detail panel for Input and Output. Pass calls (or render ToolCallGroup directly) to group every call from one assistant turn under a "Used N tools" header with an overlapping stack of tool marks and total duration.
The component never executes tools or mutates external state. It reports user decisions through onApprove, onDeny, onRetry, or host-registered onAction events, while your application updates each call's status and output.
Usage
Single call
import { ToolCall } from '@uthereal/ui/tool-call'
export function IssueLookup() {
return (
<ToolCall
tool="github"
title="Searched issues in acme/web"
titles={{ running: 'Searching issues in acme/web' }}
status="complete"
input={{ repo: 'acme/web', query: 'is:open label:release-blocker' }}
output={{
kind: 'list',
items: [
{
lead: '#1284',
title: 'Checkout button stays disabled after coupon removal',
tag: 'checkout',
},
{
lead: '#1291',
title: 'Webhook retry posts a second charge after a 504',
tag: 'billing',
},
],
}}
durationMs={1180}
/>
)
}Multi-call turn summary
import { ToolCallGroup, type ToolCallItem } from '@uthereal/ui/tool-call'
export function AssistantTurnTools({
calls,
working,
onApprove,
onDeny,
onRetry,
}: {
calls: readonly ToolCallItem[]
working: boolean
onApprove: (call: ToolCallItem) => void
onDeny: (call: ToolCallItem) => void
onRetry: (call: ToolCallItem) => void
}) {
return (
<ToolCallGroup
calls={calls}
active={working}
onApprove={onApprove}
onDeny={onDeny}
onRetry={onRetry}
/>
)
}Examples
Turn group
Several calls from one assistant turn grouped under "Used N tools" with an overlapping brand mark stack and total duration. Set active while the agent is between calls so the header keeps reading "Using N tools" with a shimmer.
- repo
- acme/web
- path
- src/checkout
- since
- 2026-10-10
- #4812Refactor address autofill listenersmerged
- #4809Update shipping estimate currency formattingmerged
- table
- checkout_events
- window
- 7d
| Browser | Errors | Change |
|---|---|---|
| Safari | 1284 | +9.2% |
| Chrome | 94 | +0.1% |
No output.
No output.
- channel
- #release-notes
- limit
- 20
Approval and retry
Human-in-the-loop permission prompts highlight the row with an accent edge, a reason line, and inline Deny / Allow buttons. Failed calls display the error reason and an inline Retry button; denied and cancelled calls settle with muted phrasing.
- channel
- #release
- text
- Safari autofill hotfix verified in staging; ready to ship.
Runs after you allow it.
Statement timed out after 2.0s on full table scan
Not run. This call was cancelled.
Structured outputs
Built-in views for list, table (folding after 5 rows), syntax-tinted json (folding after 10 lines behind "Show N more lines"), and text, each with a copy button.
- range
- Oct 10–15
- groupBy
- browser, platform
| Browser | Platform | Sessions | Conversion |
|---|---|---|---|
| Safari | macOS | 14200 | 3.1% |
| Safari | iOS | 28400 | 2.8% |
| Chrome | macOS | 31100 | 4.6% |
| Chrome | Windows | 29800 | 4.5% |
| Firefox | macOS | 6400 | 4.4% |
| Edge | Windows | 8900 | 4.3% |
{ "milestone": "v2.8", "status": "in_progress", "owner": "release-eng", "checks": { "unitTests": "passed", "e2eCheckout": "passed", "safariAutofill": "failed" }, "blockers": [
- command
- pnpm test tests/checkout
PASS checkout/autofill.spec.ts (4 tests, 1.4s) PASS billing/webhooks.spec.ts (6 tests, 0.4s)
Statuses
Each status pairs a distinct icon shape with explicit label text and live-region announcements rather than relying on color alone.
| Status | Visual indicator | Row aside & behavior |
|---|---|---|
running | Rotating spinner + shimmer | Shimmers titles.running; opens standalone row automatically. |
complete | Animated drawn check | Shows summary (or derived count) and tabular durationMs. |
error | Danger alert icon | Shows message reason line and inline Retry button. |
approval | Accent question icon + edge | Shows message reason line and inline Deny / Allow buttons. |
denied | Muted ban icon + muted title | Marks call as not run and shows quiet denied status text. |
cancelled | Muted dashed circle | Marks call as cancelled and shows quiet cancelled status text. |
In group mode (calls or ToolCallGroup), any call entering approval or error automatically opens a closed group so decisions are never hidden. Once every call settles, the group auto-collapses 450ms later unless the reader manually opened or closed the group or any row.
Structured outputs
output.kind | Layout | Folding threshold | Copy format |
|---|---|---|---|
list | Lead, title, and tag subgrid | After 5 results | One formatted line each |
table | Scrollable semantic <table> | After 5 rows | Tab-separated rows (TSV) |
json | Syntax-tinted monospace | After 10 lines | Pretty-printed JSON |
text | Wrapped plain text | None | Raw text |
Raw string outputs pretty-print as JSON when valid (or highlight using language) inside a scrollable code panel bounded by maxHeight. Supply renderOutput(output, state) to render a custom visualization inside the output well.
API reference
These serializable arguments and defaults come directly from the component schema.
| Argument | Type / default | Description |
|---|---|---|
tool | github | linear | postgres | slack | gmail | web | terminal | wrenchDefault: "github" | The tool that ran, with a built-in mark: github, linear, postgres, slack, gmail, web, terminal or wrench. |
title | string— | The settled verb phrase, e.g. "Searched issues in acme/web". Omit it to show the tool name. |
titles | object— | Phrasing per status, e.g. { running: "Searching issues" }; falls back to title. |
status | running | complete | error | approval | denied | cancelledDefault: "complete" | running (busy, opens), complete, error (reason + Retry), approval (Allow/Deny), denied or cancelled. |
input | string | object— | Arguments the model passed: an object renders as a mono key-value list; a JSON string pretty-prints. Up to 20,000 characters. |
output | string | ToolCallStructuredOutput— | What the tool returned: structured (list, table, json, text) or a raw string, which pretty-prints as JSON when it parses. Up to 100,000 characters. |
summary | string— | Quiet meta before the duration, e.g. "4 results"; derived from the output when omitted. |
message | string— | One line under the title: the error reason, or what allowing the call will do. |
durationMs | number— | How long the call took, in milliseconds; shown as 640ms or 1.2s, tabular. |
calls | ToolCallItem[]— | Every call from one assistant turn (up to 40, each with id, tool, status, input and output); provided, this row renders as the group header "Used N tools". |
active | boolean— | The agent is still working between calls, so the group header keeps saying "Using". |
approveAction | string— | Host-registered action fired when the reader allows a call; collected by collectActions, so a composition rejects it while it is not registered. |
denyAction | string— | Host-registered action fired when the reader denies a call; collected by collectActions. |
retryAction | string— | Host-registered action fired when the reader retries a failed call; collected by collectActions. |
language | text | bash | json | ts | tsx | js | python | sql | diff | markdown | yaml | html | css— | Language of a raw string output, e.g. sql; omit it for json when the output parses as JSON and text otherwise. |
inputLabel | stringDefault: "Input" | Heading of the input section. |
outputLabel | stringDefault: "Output" | Heading of the output section. |
statusLabels | ToolCallStatusLabelsDefault: {"running":"Running","complete":"Complete","error":"Failed","approval":"Needs approval","denied":"Denied","cancelled":"Cancelled"} | Accessible status text for running, complete, error, approval, denied and cancelled; also announced politely when it changes. |
copyable | booleanDefault: true | Show copy buttons on the input and output. |
copyInputLabel | stringDefault: "Copy input" | Name of the input copy button. |
copyOutputLabel | stringDefault: "Copy output" | Name of the output copy button. |
collapseOnComplete | booleanDefault: true | Close when the call finishes, unless the reader toggled it. In group mode, fold the list 450ms after every call has finished. |
defaultOpen | boolean— | Initially open. Omit it to open while running. Later edits do not reset an existing instance. |
maxHeight | integerDefault: 220 | Height of the raw input and output code before each scrolls, in pixels, 80 to 2000. |
recipe | studio | softDefault: "studio" | Visual treatment. Both recipes use the same interaction behavior. |
theme | ToolCallTheme— | Color mode, accent, and tokens, including the status colors and fontFamilyMono. See Theming. |
motion | none | subtle | expressiveDefault: "subtle" | Open and close motion. System reduced-motion preferences take precedence. |
motionOptions | DisclosureMotionOptions— | The open and close transition: a tween (ms) or a spring. |
dir | ltr | rtl— | Reading direction. Omit it to inherit the page direction. |
ToolCallStatusLabels accepts partial overrides for { running, complete, error, approval, denied, cancelled }. Built-in tool brand marks are github, linear, postgres, slack, gmail, web, terminal, and wrench.
React integration
| Prop | Purpose |
|---|---|
open, onOpenChange | Control the open state of the row or group; onOpenChange fires on user toggles and auto-close. |
onApprove, onDeny, onRetry | Handle inline decision clicks. ToolCallGroup passes the target ToolCallItem. |
onAction(action, callId?) | Fires registered approveAction, denyAction, or retryAction names (with call.id in groups). |
renderOutput(output, state) | Render custom content inside the Output well; return undefined to fall back to the built-in view. |
renderToolMark(tool, size) | Replace a tool's built-in 16px row mark or 12px group stack mark. |
renderIcon(name, context) | Replace a status icon (status), chevron (indicator), or code block icon (file). |
highlight | Syntax highlighter function for raw string outputs. |
preset, tokens | Application defaults and inline --ui-* token overrides. |
ref, className, style | Applied to the root container element. |
Keyboard & accessibility
| Key | Action |
|---|---|
Tab | Moves across the group header, each row toggle, inline Deny / Allow / Retry buttons, copy buttons, and fold toggles. |
Enter, Space | Expands or collapses the group or row, activates inline decisions, copies input/output, or toggles folded rows. |
- Row toggles sit beneath row content so inline decision buttons remain valid sibling
<button>elements rather than nested buttons. - Each row toggle announces
<Tool>: <Title> <Status, summary, duration>viaaria-labelledby, and inline decision buttons use call-specific accessible names (Allow: <title>,Deny: <title>,Retry: <title>). - Input renders as a
<dl>description list and table outputs render semantic<table>/<th scope="col">markup. Folded rows receivearia-hidden="true"until expanded. - Pre-mounted polite
role="status"live regions outside buttons announce status transitions and copy outcomes without shifting button width. - Container queries (
@container) adapt cleanly below440pxby wrapping reasons, moving decision buttons beneath the reason line, dropping the 38px detail indent, and keeping only duration metadata.
Motion & theming
Row heights follow content changes on the critically damped smooth spring (0.4s, bounce 0) while container width resizes cut immediately. Status icons swap on the snappy spring (0.26s, bounce 0.12) and the success checkmark draws itself once. In group mode, newly joined tool marks widen the overlapping stack on the morph spring (0.42s, bounce 0.16), and opening staggers rows 20ms apart.
Under prefers-reduced-motion: reduce, springs, spinner rotation, stagger, and shimmer travel stop while status and copy transitions crossfade in 120ms. Setting motion="none" makes every transition immediate (0ms).
| Token | Role |
|---|---|
--ui-surface, --ui-surface-raised, --ui-surface-sunken | Row card background, soft recipe surface, and detail wells. |
--ui-border, --ui-border-subtle, --ui-border-strong | Card outline, group divider, and hovered action borders. |
--ui-text, --ui-text-secondary, --ui-muted | Titles, notes/tags, metadata, and JSON literals. |
--ui-accent, --ui-accent-foreground, --ui-focus-ring | Approval border/icon, Allow fill, and focus outlines. |
--ui-success, --ui-warning, --ui-danger | Complete check, JSON number tint, and error status/meta. |
--ui-font, --ui-font-mono, --ui-radius, --ui-radius-sm | Typography and corner radii. |
An application-wide UtherealProvider supplies theme, recipe, and motion defaults.
Composition
In an agent composition, ToolCall is a leaf component. Register approveAction, denyAction, and retryAction on the host so collectActions validates them atomically. See Building with agents.
{
"type": "ToolCall",
"props": {
"tool": "slack",
"title": "Posted to #release",
"titles": {
"approval": "Post a summary to #release"
},
"status": "approval",
"message": "Sends as Release agent to 48 people in #release",
"approveAction": "approve_tool_call",
"denyAction": "deny_tool_call"
},
"children": []
}