Skip to content
Thrum

Tool call card

A structured execution card for inspecting tool invocations and gating sensitive mutations with human-in-the-loop approval. It pairs an explicit status label and glyph with monospace JSON argument and result blocks, one-click copy buttons, and Approve or Reject actions when awaiting confirmation. For multi-step thought traces without approval gates, use the reasoning panel.

Install

npx shadcn@latest add @thrum-pro/tool-call-card

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Automatically installs icons chevron-down, circle-check, circle-slash, circle-x and terminal from the icon set.

Data shape

Type
type ToolCallStatus = "running" | "awaiting" | "success" | "error" | "rejected";
type ToolCallArgs = Record<string, unknown> | string | null;
Sample
const args = {
  charge_id: "ch_3Q9x2L8vK1",
  amount_cents: 4900,
  currency: "usd",
};

Props

PropTypeDefaultDescription
namestringRequiredMonospace tool identifier such as "sql.query_revenue" or "stripe.create_refund".
statusToolCallStatusDefault "success"Execution state: running, awaiting, success, error or rejected. Always shown with a glyph and a word.
argsRecord<string, unknown> | string | null–Input parameters formatted as monospace JSON with a copy button.
resultunknown–Output payload formatted as monospace JSON with a copy button when no error is set.
errorstring | nullDefault nullFailure message rendered in a destructive-tinted code block with a copy button.
durationMsnumber | nullDefault nullExecution time in milliseconds, formatted as ms below 1 second or seconds above.
expandedboolean–Controlled expanded state for the payload drawer. Pair with onExpandedChange.
defaultExpandedbooleanDefault falseWhether the payload drawer starts open when uncontrolled.
onExpandedChange(expanded: boolean) => void–Called when the reader expands or collapses the payload drawer.
onApprove() => void–Called when the reader clicks Approve & run while status is "awaiting".
onReject() => void–Called when the reader clicks Reject while status is "awaiting".
approvalPromptstringDefault "Review parameters before running this action."Short guidance line displayed in the approval footer.
approveLabelstringDefault "Approve & run"Text on the primary confirmation button.
rejectLabelstringDefault "Reject"Text on the outline rejection button.
pausedbooleanDefault falseFreezes the spinner animation while status is "running".
soundbooleanDefault truePlays open/close on toggle, select on approve, error on reject/failure, and success on completion.
classNamestring–Merged onto the outer panel container.

Motion and sound

Motion

  • Expanding and collapsing the Arguments and Result drawer animates height and opacity over 250 ms.
  • The header chevron rotates 180 degrees over 150 ms.
  • While running, the status spinner turns continuously; paused freezes it in place.
  • Reduced motion: disclosure changes settle immediately and the spinner stops rotating.

Sound

  • Expanding the payload drawer plays open; collapsing plays close.
  • Approving a pending tool call plays select; rejecting plays error.
  • Transitioning from running to success plays success; transitioning from running to error plays error.

Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works

Accessibility

  • The header is a native button with aria-expanded and aria-controls linked to the collapsible payload body.
  • Every lifecycle state pairs a distinct indicator (spinner, amber disc, check, cross, slash) with an explicit status word, never relying on colour alone.
  • Formatted JSON blocks are keyboard-scrollable with tabIndex=0 and pair with labelled CopyButton controls.
  • The outer frame carries data-surface="panel" and status chips use foreground ink on tinted card fills, keeping 4.5:1 contrast across Solid and Frosted glass materials.
KeysAction
Tab / Shift TabMove between the header disclosure trigger, copy buttons, scrollable JSON blocks, and Approve / Reject buttons.
Enter / SpaceExpand or collapse the card, copy a payload, or trigger Approve / Reject.

Source

SourcePro

The source comes with Pro

TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies

Files and dependencies

Adds
components/ui/tool-call-card.tsx
Packages
motion
Brings along
ButtonCopy buttonSpinnerChart foundationsMotion tokensSound engine
Icons
chevron-downcircle-checkcircle-slashcircle-xterminal

Changelog

  1. 1.0.0 · 2026-12-04First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor