Tool Call
One tool invocation inside an assistant turn. Collapsed by default — the arguments are long and the interesting part is that it ran — except a failure, which opens itself.
src/components/ui/tool-call.tsxAbout
From the component's own source, where it was written.
One tool invocation inside an assistant turn.
Collapsed by default: the arguments and the result are usually long, and the interesting part is that the tool ran at all. A failure opens on its own, because that is the case you always want to read.
Install
npx astralyx-ui add tool-call
Usage
import { ToolCall } from '@/components/ui/tool-call'
<ToolCall
name="read_file"
summary="src/lib/styles.ts"
status="done"
input={JSON.stringify(args, null, 2)}
output={result}
/>Composer
Change the props and the source below follows.
Input
json
{
"path": "src/lib/styles.ts",
"range": [1, 40]
}Output
json
{
"lines": 218,
"language": "typescript"
}Props
tsx
<ToolCall
name="read_file"
summary="src/lib/styles.ts"
status="done"
input={args}
output={result}
/>Examples
Every status
tsx
<ToolCall name="read_file" status="done" … />
API
Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.
ToolCall
One tool invocation inside an assistant turn.
Extends Omit<ComponentProps<'div'>, 'title'>.
| Prop | Type | Default | Description |
|---|---|---|---|
| name | string | required | The tool identifier, in monospace. |
| status | 'running' | 'done' | 'error' | 'done' | A failure defaults to open, because that is the case you always want to read. |
| summary | ReactNode | — | Short line beside the name — the target, the query, the file. |
| input | string | — | Rendered in CodeBlocks, collapsed past 8 and 12 lines. |
| output | string | — | Rendered in CodeBlocks, collapsed past 8 and 12 lines. |
| language | 'json' | 'bash' | 'tsx' | 'typescript' | 'json' | — |
| defaultOpen | boolean | — | — |
| inputLabel | string | 'Input' | — |
| outputLabel | string | 'Output' | — |