# Tool Call
> A collapsible card for an AI tool call, with its state, arguments and result.
Source: https://shellui.dev/docs/v0.4/components/advanced/tool-call
`ToolCall` is **new in v0.4.0**. It shows one tool call from an AI agent: the tool's name and a pending, running, done or error badge. Clicking it opens the arguments, the result or the error.
## Installation
```bash
shellui add tool-call
```
## Usage
### States
`State` is `pending`, `running` (with a spinner), `done` or `error`; any other value shows as pending.
```razor
```
### With reasoning
Update `State` and `Result` as the call progresses. Here a [Reasoning](https://shellui.dev/docs/v0.4/components/advanced/reasoning.md) block streams first, then the tool runs.
```razor
@code {
private const string Arguments = "{ \"query\": \"dialog focus trap\", \"limit\": 3 }";
private string? reasoning = "Press Run: the reasoning streams, then the tool runs.";
private bool thinking;
private TimeSpan? thought;
private string state = "pending";
private string? result;
private bool running;
private async Task RunAsync()
{
running = true;
reasoning = "";
thought = null;
state = "pending";
result = null;
thinking = true;
var started = DateTime.UtcNow;
foreach (var word in "I need the pages about the focus trap. Searching the docs.".Split(' '))
{
reasoning += word + " ";
StateHasChanged();
await Task.Delay(90);
}
thinking = false;
thought = DateTime.UtcNow - started;
state = "running";
StateHasChanged();
await Task.Delay(1500);
result = "[\n \"layout/dialog#accessibility\",\n \"layout/sheet#accessibility\"\n]";
state = "done";
running = false;
}
}
```
`Arguments`, `Result` and `Error` are shown as preformatted text, so pass JSON already indented. For anything else, such as a table of results, use child content: it is rendered below them in the open card.
## API Reference
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `Name` | `string` | `""` | The tool's name, in a monospace font |
| `State` | `string` | `"pending"` | `pending`, `running`, `done` or `error` (case doesn't matter) |
| `Arguments` | `string?` | `null` | Shown under "Arguments" when set |
| `Result` | `string?` | `null` | Shown under "Result" when set |
| `Error` | `string?` | `null` | Shown under "Error", in the destructive colour, when set |
| `ChildContent` | `RenderFragment?` | `null` | Extra content below the arguments, result and error |
| `DefaultOpen` | `bool` | `false` | Opens the card on first render |
| `Class` | `string?` | `null` | Additional CSS classes |
## Accessibility
- The header is a `