<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# ToolCallGroup

Several tool calls an agent made in a row, under one line: "Ran 3 tools", with how many failed. It is open while any call is running or waiting for the person, and closes to that line once they all settle; once the person opens or closes it, or uses a call in it, their choice holds. Each call is a ToolCall, which opens to its own output.

## Install

Once per app, with Tailwind CSS v4 and an `@/*` path alias (skip `init` in an existing shadcn app), then the component:

```sh
npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.823
npx shadcn@latest add ourostack/ouro-ui/tool-call-group#v1.3.823
```

More: [Installing](https://ui.ouroboros.bot/docs/installing.md).

```tsx
import { ToolCallGroup } from "@/components/ouro/tool-call/tool-call-group";
```

## Example

```tsx
<ToolCallGroup
  calls={[
    { id: "1", name: "Read file", detail: "recipes/roast.md", status: "done", duration: 0.4 },
    { id: "2", name: "Ran command", detail: "npm test", status: "running" },
  ]}
/>
```

## Use instead when

- Use `ToolCall` instead for a single call, and `ThinkingBlock` instead for the agent's reasoning.

## Props

Type: `ToolCallGroupProps`.

| Prop | Type | Description |
| --- | --- | --- |
| `calls` (required) | `readonly ToolCallGroupItem[]` | The calls, in the order the agent made them. |
| `className` | `string` | Layout only: margins, width (`mt-2`). Appearance classes warn in development. |
| `defaultOpen` | `boolean` | Opens it first and keeps it open after the calls settle, until the person closes it. |
| `onOpenChange` | `((open: boolean) => void)` | Called with the new state when the person opens or closes it. |
| `open` | `boolean` | Whether it is open, when you control it. Pair it with `onOpenChange`. |
| `ref` | `Ref<HTMLDivElement>` | Reaches the rendered element. |
| `summary` | `ReactNode` | The title in place of "Ran 3 tools", such as the agent's own summary: "Read the recipe and its notes". |

## Don't use

These are not props. Passing one fails the type check with the fix in the error, and in development a console message names the fix.

- `children`: Not a prop. The calls are `calls`, as data: `<ToolCallGroup calls={[{ id, name, status }]} />`.
- `title`: Not a prop. The title is `summary`: `<ToolCallGroup summary="Read the recipe">`.
- `tools`: Not a prop. The calls are `calls`: `<ToolCallGroup calls={[{ id, name, status }]} />`.

## `className` is for layout only

Pass margins, width and grid placement (`mt-4`, `w-full`, `col-span-2`).

Appearance comes from props, not classes. In development, a class that sets appearance logs one warning per component instance, naming the prop to use instead. A class sets appearance when, after its variants (`hover:`, `sm:`) and any `!` are removed, it starts with `bg-`, `text-`, `border-`, `rounded-`, `shadow-`, `font-`, `ring-`, `from-`, `via-`, `to-`, `fill-` or `stroke-`, or is `border`, `rounded`, `shadow` or `ring`, or has a `dark:` variant. Text wrapping, overflow and table layout classes (`text-wrap`, `text-ellipsis`, `border-collapse`) are layout and do not warn.

Alignment classes (`text-center`) warn too: set alignment on a parent element.

## Types

### `ToolCallGroupItem`

One call in a `ToolCallGroup`: a ToolCall's props, with an `id` that stays put as the list changes.

```ts
type ToolCallGroupItem = Pick<ToolCallProps, "name" | "status" | "detail" | "duration" | "output" | "outputLanguage"> & {
  /** A stable key for the call, such as the tool call's id from the agent's events. */
  id: string;
};
```

### `ToolCallProps`

Props for `ToolCall`.

```ts
interface ToolCallProps {
  /** What the agent did, as the person reads it: "Read file", "Ran command", "Searched the web". */
  name: ReactNode;
  /**
   * Where the call stands. `running` shows a spinner; `done` a tick; `failed` a cross and "Failed"; `waiting` (for the
   * person, such as for their permission) a clock and "Waiting for you".
   */
  status: ToolCallStatus | (string & { 'Use "running", "done", "failed" or "waiting"': never });
  /** A short summary of its arguments, in the code font, cut short on one line: `recipes/roast.md`, `npm test`. */
  detail?: ReactNode;
  /** How long it took, in seconds, shown short at the row's end: "1.2s", "2m 5s". */
  duration?: number | undefined;
  /** What the tool gave back, as plain text. With it the row opens to show it in a CodeBlock. */
  output?: string | undefined;
  /** The output's language, for CodeBlock: `"ansi"` reads terminal escape codes as colours. */
  outputLanguage?: string | undefined;
  /** Shows the output first, when the component keeps its own state. */
  defaultOpen?: boolean | undefined;
  /** Whether the output shows, when you control it. Pair it with `onOpenChange`. */
  open?: boolean | undefined;
  /** Called with the new state when the person shows or hides the output. */
  onOpenChange?: ((open: boolean) => void) | undefined;
  /** Layout only: margins, width (`mt-1`). Appearance classes warn in development. */
  className?: string | undefined;
  ref?: Ref<HTMLDivElement> | undefined;

  /** Not a prop. Where the call stands is `status`: `<ToolCall status="running">`. */
  state?: { 'Use <ToolCall status="running">': never };
  /** Not a prop. The tool's name is `name`: `<ToolCall name="Read file">`. */
  toolName?: { 'Use <ToolCall name="Read file">': never };
  /** Not a prop. A summary of the arguments is `detail`: `<ToolCall detail="recipes/roast.md">`. */
  args?: { 'Use <ToolCall detail="recipes/roast.md">': never };
  /** Not a prop. A summary of the arguments is `detail`: `<ToolCall detail="recipes/roast.md">`. */
  input?: { 'Use <ToolCall detail="recipes/roast.md">': never };
  /** Not a prop. What the tool gave back is `output`, a string: `<ToolCall output={text}>`. */
  result?: { 'Use <ToolCall output={text}>': never };
}
```
