Tool call

Free

One tool call in the agent's answer: its row names the call (the tool's real logo, the function as a code tag, the time) and folds its Arguments and Result. A secret in the arguments renders masked, and Copy copies the mask.

npx shadcn@latest add https://pixilui.com/r/tool-call.json

Preview

A secret in a tool's arguments stays masked, and Copy copies the mask, never the key.
Result
Row

When to use

Use it when

  • One call the agent made, with the evidence a person can open: what it sent and what came back.
  • A call whose arguments hold a key: it never reaches the page or the clipboard.

Use something else when

  • Several calls in one turn: they are the reasoning trail's steps.
  • A command the agent ran in a terminal: use Command.
  • A change to a file: use Diff.

Installation

Terminal
npx shadcn@latest add https://pixilui.com/r/tool-call.json

Adds tool-call.tsx with button.tsx, kbd.tsx, tooltip.tsx, code-block.tsx and badge.tsx, and installs clsx and tailwind-merge. The URL works in any app with a components.json, with no registry to add first.

Usage

example.tsx
import { ToolCall } from "@/components/pixilui/tool-call";

<ToolCall
  tool={tool}
  args={args}
  onOpenChange={onOpenChange}
/>

Fills its container; long values wrap under their own column, and the row's words keep one line.

API reference

PropTypeDefault
toolRequiredstring–The tool's name: "Stripe".
argsRequiredCodeJsonValue–The arguments it was called with.
markReactNode–The tool's real logo, on its own color (a 20 tile).
fnstring–The function it called, as a code tag: "refunds.create".
timestring–How long it took: "412 ms".
secretsRecord<string, string>{}Keys whose values are secrets, each with what it is ({ api_key: "Stripe secret key" }); values that look like keys are caught too.
resultCodeJsonValue–What it returned. Leave it out while there is none.

Also takes every native <section> attribute except title, onToggle, and a ref.

Keyboard

TabReaches the row, then each block's Copy, its masked keys and Show all.
Enter SpaceFolds or opens the blocks from the row; copies; shows all lines.

Accessibility

  • The row is a button with aria-expanded and aria-controls; a folded body is inert.
  • The section is named for the call (Called Stripe refunds.create); a masked key is role img named with its last four.
  • On touch the 20 row reaches 44 tall without growing.

Motion

  • The row folds the blocks with the system's fold (the height glides, the blocks fade into a 2px blur), and the chevron turns.
  • A long result glides open under Show all; Copy turns into its check and the masked key lights once.
  • Reduced motion: at once.
Code blockA key in the code renders masked, and Copy copies the mask, never the key.
CommandWhile it runs, the output prints in line by line and Stop ends it with ^C.
Reasoning trailFolds into one line when the answer starts; anything that went wrong stays on it.

Questions

  • A tool call: one row per call with the tool's real logo, the function as a code tag and its time, folding the arguments and the result as highlighted JSON a person can copy. A key in the arguments renders masked, and Copy copies the mask. Several calls in one turn are the reasoning trail's steps.

  • Yes. Map each tool call your framework reports to the row's tool, fn, args and result (with status and tone once it returns); the row does not depend on a framework. The guides below show that mapping for the Vercel AI SDK, LangGraph and the OpenAI Agents SDK.

Guides

Compare

Updated · ChangelogReport an issue

PixilUI Pro opens soon. The first 20 licenses are $99.