Tool call card preview

Tool call card

An agent's tool call in one line – live timer, status and summary, folds open to highlighted arguments and result with copy, retry on errors and a group that sums them up

  • Group
    Agents
  • Origin
    Copied · affectUI · source
  • License
    MIT
  • Added
    Oct 18
npx shadcn@latest add @deank/tool-call-card

The registry stays private. Install from the repo with a GitHub token — see the README.

Usage

import { ToolCallCard } from "@/registry/components/tool-call-card/tool-call-card";

<ToolCallCard name="…" status={/* … */}>Label</ToolCallCard>

Props

NameTypeDefaultDescription
namestringTool name as the agent calls it, shown in mono – e.g. "search_web"
status"running" | "success" | "error"Spinner with a live timer, check with the duration, or a red "Failed"
summaryReactNodeShort human summary next to the name; truncates with an ellipsis
iconReactNodewrench iconIcon in the tile on the left – a 16px stroke SVG fits best
argsunknownArguments – objects are pretty-printed and highlighted, JSON strings are parsed; the section is hidden when undefined
resultunknownWhat the tool returned – like args; other strings are shown as plain text. While running without a result, "Waiting for result…" is shown
errorstringError message, shown in the body when status is "error"
startedAtnumberStart time in ms since epoch – the live timer counts from here instead of from when the card turned running
durationnumberFinal duration in ms – otherwise the time measured while the card was running
defaultOpenbooleanfalseStart expanded (uncontrolled)
openbooleanExpanded state (controlled)
onOpenChange(open: boolean) => voidCalled when the header is toggled
openOnErrorbooleantrueOpens the card when the call fails and closes it on the next run, unless someone toggled it by hand (uncontrolled only)
onRetry() => voidShows a Retry button next to the error message
maxCodeHeightnumber220Height in px after which arguments and result are capped with a fade and a "Show all" toggle
classNamestringExtra class on the root
ToolCallGroup · childrenToolCallCard elementsThe cards – the group reads their icon, status and duration props for its header, so pass them as direct children
ToolCallGroup · labelstring"Used N tools"Header label once nothing is running
ToolCallGroup · runningLabelstring"Using tools…"Shimmering header label while any card is running
ToolCallGroup · durationnumberTotal in ms – otherwise the sum of the cards' duration props, or the time measured while any card was running
ToolCallGroup · defaultOpen / open / onOpenChangeboolean / boolean / (open) => voidfalseExpanded state, uncontrolled or controlled
ToolCallGroup · classNamestringExtra class on the root

When to use

- Tool and function calls in an agent chat or run log – what was called, with what, and what came back - Agents that call several tools per turn – wrap them in ToolCallGroup so the answer isn't buried under cards - Developer-facing views where people need to copy the exact arguments or result to debug

When not to use

Plain chat text.

Related

Thinking loader · Message actions · Agent team · Code block