# ToolCall

A tool request with its input, result, failure and duration.

- **Use it for**: One tool request with its input, result, failure and duration.
- **Not for**: Several calls of one step. Try [ToolGroup](https://unseenui.com/components/tool-group/).

## Installation

```bash
npm install @stackunseen/ui
```

## Parts

With only a `value`, ToolCall draws its summary, input and result for you. Pass the parts as children to choose which show and in what order.

```tsx
<ToolCall value={call}>
  <ToolCall.Summary />
  <ToolCall.Result />
</ToolCall>
```

1. **`ToolCall`**: Holds the call. `variant="row"` is one line that opens for details. Props: `value`, `variant`, `detail`.
2. **`ToolCall.Summary`**: The tool name and a status badge. Built from StatusBadge.
3. **`ToolCall.Input`**: The arguments, collapsed. Built from Accordion.
4. **`ToolCall.Result`**: The output or error, or what happened, such as "Waiting for approval". Built from ToolResult, LoadingIndicator.

## Usage

```tsx
import { ToolCall } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<ToolCall variant="row" value={toolCall} />
```

## Props

- `value` (`ToolCallData`): The tool id, name, revision, state and input, with optional output, error, durationMs, and a label and target you write, which rows show instead of the name.
- `variant` (`'card' | 'terminal' | 'compact' | 'row' (optional)`): Defaults to card. Row is one line per step (status, label, target, duration) with details on request; messages and Chat use it. Compact keeps execution details behind a disclosure.
- `children` (`ReactNode (optional)`): Replace the default layout with Summary, Input and Result inside ToolCall.Root.

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `children` | `ReactNode` |  |
| `className` | `string` | Added to the root element, after the component's own classes. |
| `detail` | `DetailLevel` |  |
| `value` (required) | `ToolCallData \| ToolCallInput` | Host data, or the short form `{ name }` plus what is known. |
| `variant` | `"compact" \| "card" \| "row" \| "terminal"` |  |

## Keyboard

Tab reaches input and execution disclosures. Enter or Space opens them; the input preview supports keyboard reading and scrolling.

## Works with

[AgentSteps](https://unseenui.com/components/agent-steps/), [ToolResult](https://unseenui.com/components/tool-result/), [ToolGroup](https://unseenui.com/components/tool-group/), [ExecutionTimeline](https://unseenui.com/components/execution-timeline/), [RunInspector](https://unseenui.com/components/run-inspector/), [Plan](https://unseenui.com/components/plan/), [UsageMeter](https://unseenui.com/components/usage-meter/), [WorkSummary](https://unseenui.com/components/work-summary/), [ChainOfThought](https://unseenui.com/components/chain-of-thought/), [WorkflowGraph](https://unseenui.com/components/workflow-graph/), [ConnectionStatus](https://unseenui.com/components/connection-status/), [RunBoard](https://unseenui.com/components/run-board/)

Page: https://unseenui.com/components/tool-call/
