ToolCall
Show an application-owned tool invocation and its result.
Overview
ToolCall presents an application-owned tool invocation as an expandable status, request, and optional result or error. It does not execute a tool, parse payloads, authorize data, or retain the conversation history.
Use when
A user needs to inspect the status, request, and result of an application-owned tool call.
Use instead
Use Alert for a simple status message without expandable request or result details.
Usage
import { useState } from "react";
import { ToolCall } from "@smoothie-framework/whisk-react";
const [open, setOpen] = useState(false);
<ToolCall
label="Search documentation"
request="query: deployment guide"
result="Found 3 matching pages."
state="completed"
open={open}
onOpenChange={setOpen}
/>Examples
Show live work
Map application state to the ToolCall lifecycle. activeLabel replaces the operation label only while state is running; ToolCall does not start, poll, cancel, or retry the operation.
import { useState } from "react";
import { ToolCall } from "@smoothie-framework/whisk-react";
const [open, setOpen] = useState(true);
<ToolCall
label="Search documentation"
activeLabel="Searching documentation"
request="query: deployment guide"
state="running"
open={open}
onOpenChange={setOpen}
/>Explain a failure
Supply a concise, audience-safe error. ToolCall chooses error presentation only when state is failed; your application decides what error data can be shown and how a retry works.
import { useState } from "react";
import { ToolCall } from "@smoothie-framework/whisk-react";
const [open, setOpen] = useState(true);
<ToolCall
label="Search documentation"
request="query: deployment guide"
error="Search could not finish. Try again."
state="failed"
open={open}
onOpenChange={setOpen}
/>Compose a custom disclosure
Use named parts when the compact ToolCall does not fit the application-owned presentation. Keep one trigger and one details group inside the same root; request and result content remain ordinary authored nodes.
import { useState } from "react";
import {
Code,
ToolCallDetails,
ToolCallRequest,
ToolCallResult,
ToolCallRoot,
ToolCallStatus,
ToolCallSummary,
ToolCallTrigger,
} from "@smoothie-framework/whisk-react";
const [open, setOpen] = useState(false);
<ToolCallRoot state="completed" open={open} onOpenChange={setOpen}>
<ToolCallTrigger>
<ToolCallSummary target="workspace.config.ts">
Read workspace configuration
</ToolCallSummary>
<ToolCallStatus />
</ToolCallTrigger>
<ToolCallDetails>
<ToolCallRequest><Code>workspace.config.ts</Code></ToolCallRequest>
<ToolCallResult>Read 12 settings.</ToolCallResult>
</ToolCallDetails>
</ToolCallRoot>Props
Component props
Accessibility
ToolCall renders a section containing a native button. The button exposes aria-expanded and aria-controls for the details group, so Enter and Space toggle it. Closed details are hidden and inert; payload children are unmounted by default. If a controlled close occurs while focus is inside the details, focus returns to the trigger. Status is plain accessible text by default, not a live region. Set announce only for a meaningful, infrequent update; it creates a polite, atomic status region. Decorative icons are hidden from assistive technology. Keep the operation label, status, and any error understandable without color or iconography, and do not expose credentials or unapproved request or result data.
Content guidance
Name the user-facing operation, not an internal function. Show only request and result details that are safe for this audience, and make an error say what happened and what the person can do next.