Tool Call

Visualize tool and function invocations with status, args, and results.

ToolCall shows a tool invocation inside the transcript: status badge, parameters, and result or error. Expand it when you need the payload details.

Parameters
{
  "city": "Tehran",
  "units": "metric"
}
Result
{
  "temperature": 28,
  "condition": "Clear",
  "humidity": 22
}

Installation

pnpm dlx cubix@latest add tool-call --base aria

Usage

Import
import {
  ToolCall,
  ToolCallContent,
  ToolCallHeader,
  ToolCallInput,
  ToolCallOutput,
} from "@/components/cubix/tool-call"
Example
<ToolCall name="get_weather" status="output-available" defaultOpen>
  <ToolCallHeader label="Get weather" />
  <ToolCallContent>
    <ToolCallInput parameters={{ city: "Tehran" }} />
    <ToolCallOutput result={{ temperature: 28 }} />
  </ToolCallContent>
</ToolCall>

Composition

 
ToolCall
├── ToolCallHeader
└── ToolCallContent
    ├── ToolCallInput
    └── ToolCallOutput

Features

  • Collapsible card with clear status badge and iconography
  • Pretty-printed parameters and results without a code-block dep
  • Error and denied states with distinct surfaces

Pending

Parameters
{
  "query": "rollback plan"
}

Running

Parameters
{
  "service": "checkout",
  "window": "1h"
}

Awaiting Approval

Parameters
{
  "name": "add_workspace_invites",
  "dryRun": false
}

Completed

Parameters
{
  "city": "Tehran",
  "units": "metric"
}
Result
{
  "temperature": 28,
  "condition": "Clear",
  "humidity": 22
}

Error

Parameters
{
  "invoiceId": "inv_98421"
}
Error
Upstream billing API timed out after 10s.

Denied

Parameters
{
  "workspaceId": "ws_104"
}
Error
User denied this tool call.

Collapsed

Status cycle

Parameters
{
  "source": "prometheus",
  "range": "15m"
}

Stack

In a message

Parameters
{
  "city": "Tehran",
  "units": "metric"
}
Result
{
  "temperature": 28,
  "condition": "Clear",
  "humidity": 22
}
Tehran is clear at 28°C with low humidity. Good window for the outdoor cutover checklist.

API Reference

ToolCall

PropTypeDefaultDescription
namestring-Tool or function name shown in the header.
statusToolCallStatus"input-available"Lifecycle state: Pending, Running, Awaiting Approval, Responded, Completed, Error, Denied.
openboolean-Controlled open state for the collapsible details.
defaultOpenboolean-Initial open state. Defaults open for pending, approval, and error.
onOpenChange(open: boolean) => void-Called when the panel opens or closes.

ToolCallHeader

PropTypeDefaultDescription
labelReact.ReactNode-Optional human-readable title. When set, the tool name appears as a subtitle.
childrenReact.ReactNode-Optional custom header content instead of the default layout.

ToolCallInput

PropTypeDefaultDescription
parametersunknown-Tool arguments. Objects are pretty-printed as JSON. Alias: input.
inputunknown-Alias for parameters.
titleReact.ReactNode"Parameters"Section label above the parameters.
childrenReact.ReactNode-Custom parameters body instead of auto-formatted JSON.

ToolCallOutput

PropTypeDefaultDescription
resultunknown-Successful tool result. Objects are pretty-printed as JSON. Alias: output.
outputunknown-Alias for result.
errorReact.ReactNode-Error content. Forces the Error section title when set. Alias: errorText.
errorTextReact.ReactNode-Alias for error.
titleReact.ReactNode-Section label. Defaults to "Result" or "Error".
childrenReact.ReactNode-Custom output body instead of result/error helpers.