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.tsx

About

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

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'>.

PropTypeDefaultDescription
namestringrequiredThe tool identifier, in monospace.
status'running' | 'done' | 'error''done'A failure defaults to open, because that is the case you always want to read.
summaryReactNode—Short line beside the name — the target, the query, the file.
inputstring—Rendered in CodeBlocks, collapsed past 8 and 12 lines.
outputstring—Rendered in CodeBlocks, collapsed past 8 and 12 lines.
language'json' | 'bash' | 'tsx' | 'typescript''json'—
defaultOpenboolean——
inputLabelstring'Input'—
outputLabelstring'Output'—