# Tool call card

Show a tool request, its arguments, approval actions and result.

Access: pro. Category: Blocks. Kind: composite.

## When to use

- Use it when a page needs show a tool request, its arguments, approval actions and result.
- Choose it inside an authenticated product surface when the host application owns routing, persistence, and service calls.

## Alternatives

- Choose empty-state instead when empty collections, search results and errors with a clear next action is the actual interface need, rather than tool call card.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Tool call card

```sh
npx shadcn@latest add @tidal-pro/tool-call-card
```

Stylesheets: `components/ui/tidal.css`, `components/ui/tool-call-card.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/tool-call-card.css";
import{TidalToolCallCard}from"./components/ui/tool-call-card";
export default()=><div className="tidal-scope"><TidalToolCallCard status={"queued"} title={"Demo"} toolName={"Demo"}/></div>;
```

## Structured props

- `TidalToolCallCard.status: TidalToolCallStatus`: Required status value accepted by this exported component.
- `TidalToolCallCard.title: ReactNode`: Required title value accepted by this exported component.
- `TidalToolCallCard.toolName: string`: Required tool name value accepted by this exported component.
- `TidalToolCallCard.actions?: ReadonlyArray<TidalToolCallAction> | undefined` (default []): Optional actions value accepted by this exported component.
- `TidalToolCallCard.actionsLabel?: string | undefined` (default "Tool actions"): Optional actions label value accepted by this exported component.
- `TidalToolCallCard.announceStatus?: boolean | undefined` (default false): Optional announce status value accepted by this exported component.
- `TidalToolCallCard.argumentsLanguage?: string | undefined` (default "JSON"): Optional arguments language value accepted by this exported component.
- `TidalToolCallCard.argumentsText?: string | undefined`: Optional arguments text value accepted by this exported component.
- `TidalToolCallCard.defaultDetailsOpen?: boolean | undefined` (default false): Optional default details open value accepted by this exported component.
- `TidalToolCallCard.detailsLabel?: string | undefined` (default "Details"): Optional details label value accepted by this exported component.
- `TidalToolCallCard.detailsOpen?: boolean | undefined`: Optional details open value accepted by this exported component.
- `TidalToolCallCard.error?: ReactNode`: Optional error value accepted by this exported component.
- `TidalToolCallCard.footer?: ReactNode`: Optional footer value accepted by this exported component.
- `TidalToolCallCard.headingLevel?: 2 | 3 | 4 | 5 | 6 | undefined` (default 3): Optional heading level value accepted by this exported component.
- `TidalToolCallCard.onDetailsOpenChange?: ((open: boolean, event: MouseEvent<HTMLElement>) => void) | undefined`: Callback invoked when the details open change interaction is proposed.
- `TidalToolCallCard.resultText?: string | undefined`: Optional result text value accepted by this exported component.
- `TidalToolCallCard.statusLabel?: string | undefined`: Optional status label value accepted by this exported component.
- `TidalToolCallCard.summary?: ReactNode`: Optional summary value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/tool-call-card.tsx) | [Manifest](https://tidalui.com/examples/tool-call-card.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useLayoutEffect, useRef, useState } from "react";

import { TidalToolCallCard, type TidalToolCallStatus, type TidalToolCallAction } from "./components/ui/tool-call-card";

import "./components/ui/tool-call-card.css";

import "./components/ui/status-badge.css";

import "./components/ui/collapsible-panel.css";

import "./components/ui/code-block.css";



const tidalExampleStyles = ".tidal-scope .tool-call-demo {\n  width: min(100%, 640px);\n  min-width: 0;\n}\n.tidal-scope .tool-call-demo-state {\n  display: flex;\n  align-items: center;\n  justify-content: flex-end;\n  gap: 10px;\n  margin-bottom: 14px;\n  color: var(--t-muted);\n  font-size: 12px;\n}\n.tidal-scope .tool-call-demo-state select {\n  max-width: 100%;\n  min-height: 44px;\n  padding: 8px 34px 8px 12px;\n  border: 1px solid var(--t-border);\n  border-radius: var(--t-radius-control);\n  color: var(--t-ink);\n  background: var(--t-surface);\n  font-size: 16px;\n}";

const argumentsText = JSON.stringify(
  { query: "Install TidalUI in a React app", limit: 3 },
  null,
  2,
);

const resultText = JSON.stringify(
  { matches: [{ title: "Installation", path: "/docs" }] },
  null,
  2,
);

export function ToolCallCardDemo() {
  const [status, setStatus] = useState<TidalToolCallStatus>("needs-approval");
  const [open, setOpen] = useState(true);
  const card = useRef<HTMLElement>(null);
  const firstAction = useRef<HTMLButtonElement>(null);
  const restoreActionFocus = useRef<"action" | "result" | null>(null);
  function changeFromAction(next: TidalToolCallStatus) {
    restoreActionFocus.current = next === "succeeded" ? "result" : "action";
    if (next === "succeeded") setOpen(true);
    setStatus(next);
  }
  useLayoutEffect(() => {
    if (!restoreActionFocus.current) return;
    const requested = restoreActionFocus.current;
    restoreActionFocus.current = null;
    if (document.activeElement !== document.body) return;
    const target = requested === "result" ? card.current : firstAction.current;
    target?.focus({ preventScroll: true });
  }, [status]);
  const actions: TidalToolCallAction[] =
    status === "needs-approval"
      ? [
          {
            actionId: "approve",
            label: "Approve",
            emphasis: "primary",
            onAction: () => changeFromAction("running"),
          },
          {
            actionId: "decline",
            label: "Decline",
            onAction: () => changeFromAction("cancelled"),
          },
        ]
      : status === "running"
        ? [
            {
              actionId: "finish",
              label: "Complete sample",
              emphasis: "primary",
              onAction: () => changeFromAction("succeeded"),
            },
            {
              actionId: "stop",
              label: "Stop",
              onAction: () => changeFromAction("cancelled"),
            },
          ]
        : [
            {
              actionId: "reset",
              label: "Reset sample",
              onAction: () => changeFromAction("needs-approval"),
            },
          ];
  return (
    <div className="tool-call-demo">
      <label className="tool-call-demo-state">
        State{" "}
        <select
          value={status}
          onChange={(event) =>
            setStatus(event.currentTarget.value as TidalToolCallStatus)
          }
        >
          <option value="needs-approval">Needs approval</option>
          <option value="queued">Queued</option>
          <option value="running">Running</option>
          <option value="succeeded">Completed</option>
          <option value="failed">Failed</option>
          <option value="cancelled">Cancelled</option>
        </select>
      </label>
      <TidalToolCallCard
        ref={card}
        tabIndex={-1}
        aria-label="Search documentation"
        title="Search documentation"
        toolName="search_docs"
        status={status}
        announceStatus
        summary="Find installation instructions for a React project."
        argumentsText={argumentsText}
        resultText={status === "succeeded" ? resultText : undefined}
        error={
          status === "failed"
            ? "Example error: the search provider did not respond."
            : undefined
        }
        detailsOpen={open}
        onDetailsOpenChange={setOpen}
        actions={actions.map((action, index) => ({
          ...action,
          buttonRef: index === 0 ? firstAction : undefined,
        }))}
        footer="Local sample. No tool is run."
      />
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <ToolCallCardDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Required title, toolName and status (queued, running, needs-approval, succeeded, failed, cancelled). Optional statusLabel, announceStatus, summary, error, argumentsText/resultText as exact plain strings, argumentsLanguage (default JSON), controlled or uncontrolled Details disclosure, headingLevel2-6, footer, native article attributes and forwarded ref. Actions have stable actionId, ReactNode label, emphasis, native button attributes/ref and onAction; native onClick runs first and prevention cancels onAction. Native disabled and aria-disabled true are normalized to actual disabled. The card composes TidalStatusBadge, TidalCollapsiblePanel and TidalCodeBlock, so code is text and never parsed or run. Consumer owns all tool execution, approval, cancellation, errors and result state. No tool, request, navigation or storage side effect is introduced.
