# Tool Call

A card for one function call made by an AI model: a ring spins round its icon while in flight, the tile turns green when it lands, input and output sit in one panel with coloured JSON, and a failure shakes once and offers Retry.

- Page and source: https://uibrik.com/components/tool-call
- Install (Pro, needs a license key, see https://uibrik.com/docs/pro): `npx shadcn@latest add @uibrik-pro/tool-call`
- Packages: none beyond React
- Import: `import { ToolCall } from "@/components/uibrik/tool-call/tool-call"`

Where to use the Tool Call React component:

- **Agent chat transcripts**: Each tool the model uses shows up inline with its arguments and result, so users can see what it did and why. Pairs with [Streaming Chat](https://uibrik.com/components/streaming-chat) and [Agent Trace](https://uibrik.com/components/agent-trace).
- **Developer consoles**: Status, live duration and pretty-printed output make debugging tool use quick without opening logs. Pairs with [Code Block](https://uibrik.com/components/code-block).
- **Approval and retry flows**: A failed call explains the error in place and offers one Retry action. Pairs with [Inline Confirm](https://uibrik.com/components/inline-confirm).

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| defaultExpanded | `boolean` | `true` | Open the input and output panel on mount. |
| maxLines | `number` | `6` | Output lines shown before Show all. |
| name | `string` |  | The function name, shown in mono. |
| description | `string` |  | A short human label under the name. |
| args | `Record<string, unknown>` |  | Arguments the model passed, listed as key/value rows. |
| status | `"pending" \| "running" \| "success" \| "error"` | `"success"` | Where the call is. Running shows a live timer; error shakes once. |
| result | `unknown` |  | What the tool returned. Objects are pretty-printed as JSON. |
| error | `string` |  | Shown when status is error. |
| duration | `number` |  | Final duration in ms. While running and unset, the card counts up itself. |
| icon | `ReactNode` |  | Icon in the tile. Defaults to a gear. |
| expanded / onExpandedChange | `boolean / (expanded) => void` |  | Controlled open state. Closed shows a one-line preview of the arguments. |
| onRetry | `() => void` |  | Shows a Retry button on failure. |
| className | `string` |  | Classes for the card. |
