---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Tool call

One tool call of an AI agent's run, as a row that opens onto its input and output, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `ToolCall`.

## When to use

- One tool call of an AI agent's run, as a row that opens onto its input and output.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Tool call on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-tool-call.json --yes
```

```text
Add the Goop Tool call to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { ToolCall } from '@/components/ui/goop/tool-call';

<div className="flex w-96 flex-col gap-2">
  <ToolCall
    name="search_sites"
    state="done"
    summary="Found 3 sites"
    input={{ query: 'dental surgeries', near: 'Leeds', limit: 3 }}
    output={'Station Road Surgery\nKirkgate Dental\nHyde Park Practice'}
  />
  <ToolCall name="book_rooms" state="running" summary="Booking 2 rooms" input={{ sites: [1, 3] }} />
</div>
```

- Fits: chat (its recipe).
- A run's tool calls stand one under the other in the thread, between the agent's messages, each its own ToolCall 8 px apart. A call that waits for a person's yes is an ApprovalRequest, with the call's input as its details.
- width, padding, gap, text: add no class for these.

## API reference

### Options

- `name: string` — The tool's name as the agent calls it (`search_sites`), shown in the theme's mono.
- `state: 'running' | 'done' | 'failed'` — Where the call is: `running`, `done` or `failed`.
- `summary?: string` — One line on what the call did ("Found 3 sites"), after the name in grey, cut with an ellipsis.
- `input?: unknown` — What the tool was given: a string as it is, anything else (the call's arguments) as JSON on two spaces.
- `output?: unknown` — What the tool gave back (its error when `failed`), drawn as `input` is.
- `open?: boolean` — The body shown (controlled); pair it with `onOpenChange`.
- `defaultOpen?: boolean = false` — The body shown on the first paint (uncontrolled).
- `onOpenChange?: (open: boolean) => void` — Called with the new open state when the row is pressed.
- `labels?: Partial<ToolCallLabels>` — The words it says, any of them replaced: the states', the body's headings, its waiting and empty lines.

- State: open (open / defaultOpen / onOpenChange)
- Types: ToolCallLabels = { running: string; done: string; failed: string; input: string; output: string; error: string; waiting: string; empty: string }

## Keyboard

- Enter / Space: open or close the call's body, its input and its output (aria-expanded says which)
- Tab: move from the row to the copy buttons of a shown body's code blocks, then on to the next call

## Accessibility

- The part itself answers the keys above.
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Tab bar](/themes/trail/components/tab-bar): A phone screen's bottom navigation.
- [Sortable list](/themes/trail/components/sortable-list): A list of rows a person puts in order, by dragging a row's handle or by the keys (Space, the arrows, Space), each step said aloud.
- [Reply status](/themes/trail/components/reply-status): The line an AI reply shows while it thinks and after it.
- [Reply actions](/themes/trail/components/reply-actions): The row of actions under an AI answer that copies it, rates it good or bad and asks for it again.
