Tool Call Card
ToolCallCard is the audit trail for agent actions. Status colors, a JSON argument preview, timing, and error output make every tool call inspectable without leaving the transcript.
ToolCallCard ships with a full API table, a copyable example, and accessibility notes.
Installation
Install the package once, then import ToolCallCard from its direct entry point or from the root.
pnpm add @agent-ui/reactimport { ToolCallCard } from "@agent-ui/react/tool-call-card";Tailwind CSS v4 users: add @source "../node_modules/@agent-ui/react/src" to the global stylesheet so the library utilities are generated.
Usage
The example below is the same code that renders the preview. Copy it, swap in your own handlers, and ship.
import { ToolCallCard } from "@agent-ui/react"; <ToolCallCard name="search_web" status="success" args={{ query: "latest AI news" }} result='[{"title":"..."}]' duration={1234}/>API reference
Every prop ToolCallCard accepts, its type, default, and behaviour.
| Name | Type | Default | Description |
|---|---|---|---|
| name | string | — | Tool name shown in the header. |
| status | "pending" | "running" | "success" | "error" | — | Status pill and border treatment. |
| args | Record<string, unknown> | — | Arguments rendered as formatted JSON. |
| result | string | — | Result string rendered below the details. |
| error | string | — | Error message when status is error. |
| details | unknown | — | Additional structured metadata. |
| duration | number | — | Execution time in milliseconds. |
| className | string | — | Inherits every native div attribute, including id, aria-*, data-*, onClick, and style. |
Compound parts
ToolCallCard exposes these parts for composition.
| Part | Description |
|---|---|
| ToolApproval | Block variant that asks the user to approve or reject a call before it runs. |
ToolCallCard composes with MessageList, ChatShell, useChat, and the provider compose blocks. Browse the full reference or see all components in the gallery.
9 lines · copy-ready