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-callUsage
import {
ToolCall,
ToolCallContent,
ToolCallHeader,
ToolCallInput,
ToolCallOutput,
} from "@/components/cubix/tool-call"<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
└── ToolCallOutputFeatures
- 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
API Reference
ToolCall
| Prop | Type | Default | Description |
|---|---|---|---|
| name | string | - | Tool or function name shown in the header. |
| status | ToolCallStatus | "input-available" | Lifecycle state: Pending, Running, Awaiting Approval, Responded, Completed, Error, Denied. |
| open | boolean | - | Controlled open state for the collapsible details. |
| defaultOpen | boolean | - | Initial open state. Defaults open for pending, approval, and error. |
| onOpenChange | (open: boolean) => void | - | Called when the panel opens or closes. |
ToolCallHeader
| Prop | Type | Default | Description |
|---|---|---|---|
| label | React.ReactNode | - | Optional human-readable title. When set, the tool name appears as a subtitle. |
| children | React.ReactNode | - | Optional custom header content instead of the default layout. |
ToolCallInput
| Prop | Type | Default | Description |
|---|---|---|---|
| parameters | unknown | - | Tool arguments. Objects are pretty-printed as JSON. Alias: input. |
| input | unknown | - | Alias for parameters. |
| title | React.ReactNode | "Parameters" | Section label above the parameters. |
| children | React.ReactNode | - | Custom parameters body instead of auto-formatted JSON. |
ToolCallOutput
| Prop | Type | Default | Description |
|---|---|---|---|
| result | unknown | - | Successful tool result. Objects are pretty-printed as JSON. Alias: output. |
| output | unknown | - | Alias for result. |
| error | React.ReactNode | - | Error content. Forces the Error section title when set. Alias: errorText. |
| errorText | React.ReactNode | - | Alias for error. |
| title | React.ReactNode | - | Section label. Defaults to "Result" or "Error". |
| children | React.ReactNode | - | Custom output body instead of result/error helpers. |