Skip to main content

Chat

ToolCall

One call an agent made to a tool, as a row in its conversation: a status icon, what it did, a summary of the arguments and how long it took. A call with output is a Collapsible whose title is the row, and it opens to show the output in a CodeBlock. A failed call says "Failed" and a waiting one "Waiting for you" in words, not only by colour, and a screen reader hears the status after the row.

Searched the web one-oven dinner for six, running
Edit file recipes/roast.md, waiting for you

Install

Hand it to your agent
Add ToolCall from Ouro UI to this app. Read https://ui.ouroboros.bot/docs/tool-call.md first and follow it.

Or by hand. Once per app, with Tailwind CSS v4 and an @/* path alias (Ouro HX is built on Base UI, so --base base; skip -t in an existing app):

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

Then the component (Installing):

npx shadcn@latest add ourostack/ouro-ui/tool-call#v1.3.823
import { ToolCall } from "@/components/ouro/tool-call/tool-call";

Paths use shadcn's default @/ alias; the CLI rewrites them to yours.

Example

<ToolCall name="Ran command" detail="npm test" status="done" duration={4.2} output={log} outputLanguage="ansi" />

Use instead when

  • Use ToolCallGroup instead for several calls in a row, under one "Ran 3 tools" line.
  • Use ThinkingBlock instead for the agent's reasoning, and CodeBlock alone for code that isn't a tool's output.

Props

Type: ToolCallProps.

className
Type: string
Layout only: margins, width (mt-1). Appearance classes warn in development.
defaultOpen
Type: boolean
Shows the output first, when the component keeps its own state.
detail
Type: ReactNode
A short summary of its arguments, in the code font, cut short on one line: recipes/roast.md, npm test.
duration
Type: number
How long it took, in seconds, shown short at the row's end: "1.2s", "2m 5s".
name (required)
Type: ReactNode
What the agent did, as the person reads it: "Read file", "Ran command", "Searched the web".
onOpenChange
Type: ((open: boolean) => void)
Called with the new state when the person shows or hides the output.
open
Type: boolean
Whether the output shows, when you control it. Pair it with onOpenChange.
output
Type: string
What the tool gave back, as plain text. With it the row opens to show it in a CodeBlock.
outputLanguage
Type: string
The output's language, for CodeBlock: "ansi" reads terminal escape codes as colours.
ref
Type: Ref<HTMLDivElement>
Reaches the rendered element.
status (required)
Type: "failed" | "running" | "done" | "waiting"
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".

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.

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

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.