Tool Call

One tool the agent used: what it sent, what came back, how long it took.

PROGet Tool Call and 168 other Pro components with pro lifetime — Get Pro

Category
AI Agent
Access
Pro
Source
342 lines · one file
States
6 drawn

The decision inside it

A label for people, a name for debugging

"Read the audit trail" is what a person reads; `audit.list_events` sits beside it in small type for whoever has to trace it. Neither replaces the other.

When to use it

Use Tool Call to show one call an agent made: a readable label, the real tool name, a one-line summary, coloured JSON input and output, copy, and an error with Retry. Agent Timeline and Agent Workspace use it for every tool.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Tool Call for this.
Install it: npx shadcn@latest add @liro/tool-call
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/tool-call.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/tool-row.tsx
import { ToolCall } from "@/components/ui/tool-call";

export function ToolRow({ onRetry }: { onRetry: () => void }) {
  return (
    <ToolCall
      name="invoices.search"
      label="Searched invoices"
      status="success"
      summary="2 unpaid invoices"
      input={{ status: "open", olderThanDays: 30 }}
      output={[{ id: "INV-2041", amount: 1200 }]}
      duration="0.8s"
      onRetry={onRetry}
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
namestring YesThe tool's real name: `email.send`.
labelReact.ReactNode NoWhat it did, in plain words. Defaults to the name.
iconReact.ReactNode No–
statusToolStatus Yes–
summaryReact.ReactNode NoThe one fact worth reading while it is closed.
inputunknown NoWhat was sent. An object is shown as JSON.
outputunknown NoWhat came back: an object, a string, or a node to render as it is.
errorReact.ReactNode NoWhy it failed. Shown when `status` is `error`, and opens the card.
durationnumber | string NoMilliseconds as a number, or your own text.
defaultOpenboolean No–
openboolean No–
onOpenChange(open: boolean) => void No–
onRetry() => void No–
maxLinesnumber NoLines of a block shown before "Show all". Default 12.

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-themebutton

States

All of them are drawn by the component. None is left for you to design.

  • Pending
  • Running
  • Success
  • Error
  • Not allowed
  • Stopped

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances