# ToolCall

> Collapsible tool invocation with status, JSON arguments and JSON result.

Source: https://ui.jcsoftdev.com/docs/components/tool-call

Collapsible tool invocation with status, JSON arguments and JSON result.

## Import

```ts
import { ToolCall } from "@jcsoftdev/ui/ai";
```

Single-component entry points tree-shake to just this component: `@jcsoftdev/ui/ai/tool-call`.

## Usage

```tsx
<ToolCall
  name="buscar_turnos"
  status="done"
  duration="1,2 s"
  defaultOpen
  args={{ fecha: "2026-06-20", barbero: "Diego Quispe" }}
  result={{ libres: ["10:00", "11:30", "16:00"], total: 3 }}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `name` * | `string` |  | Tool identifier, e.g. `buscar_turnos`. |
| `status` | `"done" \| "error" \| "pending" \| "running"` | `"pending"` |  |
| `args` | `unknown` |  | Arguments sent to the tool; shown as formatted JSON. |
| `result` | `unknown` |  | Result returned by the tool; shown as formatted JSON. |
| `error` | `string` |  | Error text when `status` is `error`. |
| `duration` | `string` |  | Pre-formatted duration, e.g. `1,2 s`. |
| `defaultOpen` | `boolean` | `false` |  |
| `className` | `string` |  |  |

`*` marks a required prop.

## Storybook stories

- [Default](/storybook/?path=/story/ai-toolcall--default)
- [Running](/storybook/?path=/story/ai-toolcall--running)
- [Failed](/storybook/?path=/story/ai-toolcall--failed)
- [Narrow](/storybook/?path=/story/ai-toolcall--narrow)
- [Preset Brutal](/storybook/?path=/story/ai-toolcall--preset-brutal)

## Source

`packages/ui/src/ai/tool-call/tool-call.tsx`
