Ballmac UI home

Tool Call Card

Shows one agent tool call: the tool name, a pending, running, success or error status with icon and text, duration, and collapsible pretty-printed input and result.

Success842ms
Input
{
  "query": "install a component into a src/ project",
  "limit": 3
}
Result
[
  {
    "title": "Installation",
    "url": "/docs/installation"
  },
  {
    "title": "CLI & registry",
    "url": "/docs/registry"
  }
]

Installation

$ pnpm dlx shadcn@latest add @ballmac/tool-call-card

Usage

import { ToolCallCard, ToolCallStatusBadge, formatToolDuration } from "@/components/ballmac/tool-call-card"

The full example is in the Code tab above.

Examples

All states

Pending
Running
Success214ms
Error3.1s

API reference

<ToolCallStatusBadge>

PropTypeDefault
status*

The tool call's lifecycle state. Rendered as an icon plus text, never color alone.

ToolCallStatus—

<ToolCallCard>

PropTypeDefault
name*

Tool name, shown in monospace, for example "search_docs".

string—
status

Lifecycle state of the call.

ToolCallStatus"pending"
duration

How long the call took, in milliseconds.

number—
input

Arguments the model passed. Objects are pretty-printed as JSON; strings are shown as-is.

unknown—
result

What the tool returned, or the error message when status is "error".

unknown—
description

Short human description shown under the name.

React.ReactNode—
open

Controlled open state of the details panel.

boolean—
defaultOpen

Initial open state when uncontrolled.

booleanfalse
onOpenChange

Called when the details panel opens or closes.

(open: boolean) => void—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Enter / SpaceOn the tool name, opens or closes the input and result (aria-expanded)
TabFocuses the scrollable input and result blocks so long JSON can be scrolled with the keyboard
—Status changes are announced politely; status is always icon plus text

Use with AI

Render each tool invocation of an agent: <ToolCallCard name status duration input result />. Objects are shown as indented JSON, strings as-is; the details panel is a disclosure (collapsed by default). With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Tool Call Card (@ballmac/tool-call-card) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Showing function/tool calls inside an assistant message
  • Agent run logs where each step calls a tool and returns data
  • Debug views for MCP tool calls

Not for

  • Generic key/value data (use a table or description list)
  • Long source files (use code-block)

Registry JSON: https://ui.ballmac.com/r/tool-call-card.json

Credits

Free to use in personal and commercial projects.