Tool
Summarize a run of tool calls in one line, and let users open it to see each search, read, and command the assistant ran.
- Searched usePreferences
- Read src/lib/preferences.ts
- Read src/routes/settings/+page.svelte
- Output
✓ saves the theme preference ✓ restores preferences after sign-in 2 passed in 3.08s
Input{ "command": "bun test preferences", "cwd": "apps/web" }
Installation
Copy the command below and run it in your terminal.
Usage
Tool is styled to match Reasoning, so a run of tool calls sits beside a reasoning trace
without a second visual language. Set running on Root while the calls run. Turning it on opens the calls and starts a timer. Trigger shows a shimmering status, such as
“Running tests”, then settles into its summary. Without a summary it reads
“Worked for” and the elapsed time. Pass duration in seconds to restore a saved transcript. Content mounts on its first open and stays
mounted, so calls can keep arriving while it is closed.
Each Call sits on the rail with an action and a monospace target. A call with state="running" shimmers its action, and state="error" marks it failed. Calls blur in as they are added. Give a call an icon snippet to replace the dot on the rail. Give it children, usually Output and Input, and the row becomes a button that
expands them.
Trigger shows no icon by default. Pass an icon snippet to add one, or a children snippet to render your own label. Both receive open, running, and seconds.
Examples
Coding agent
- Searched usePreferences
- Read src/lib/preferences.ts
- Read src/routes/settings/+page.svelte
- Output
✓ saves the theme preference ✓ restores preferences after sign-in 2 passed in 3.08s
Input{ "command": "bun test preferences", "cwd": "apps/web" }
Live calls
Root times the group while running is on. Give a running call a present-tense action, such as “Reading”, and change it
to “Read” when the call finishes; the label crossfades. Set the trigger status to the current step. This example swaps each call's icon for a spinner while it runs.
Failed call
- Ran bun run lint
- Error
src/lib/refunds.ts:42:18 Type 'string | undefined' is not assignable to type 'string'.
Anatomy
Tool.Root - Times the group while running and controls visibility.
Tool.Trigger - Shows an optional icon, the live status, and timer, then the summary.
Tool.Content - Lists the calls on a rail.
Tool.Call - Shows one call with its icon, action, and target.
Tool.Input - Shows the arguments a call was made with.
Tool.Output - Shows what a call returned.
<script lang="ts"> import FileText from '@lucide/svelte/icons/file-text'; import Search from '@lucide/svelte/icons/search'; import Terminal from '@lucide/svelte/icons/terminal'; import * as Tool from '@sivir-ui/svelte/components/tool'; const input = JSON.stringify( { command: 'bun test preferences', cwd: 'apps/web' }, null, 2 ); const output = [ '✓ saves the theme preference', '✓ restores preferences after sign-in', '2 passed in 3.08s' ].join('\n'); </script> <Tool.Root duration={4} open class="w-full max-w-xl"> <Tool.Trigger status="Running tests" summary="Searched once, read 2 files, ran tests" /> <Tool.Content> <Tool.Call action="Searched" target="usePreferences"> {#snippet icon()}<Search />{/snippet} </Tool.Call> <Tool.Call action="Read" target="src/lib/preferences.ts"> {#snippet icon()}<FileText />{/snippet} </Tool.Call> <Tool.Call action="Read" target="src/routes/settings/+page.svelte"> {#snippet icon()}<FileText />{/snippet} </Tool.Call> <Tool.Call action="Ran" target="bun test preferences" open> {#snippet icon()}<Terminal />{/snippet} <Tool.Output> <pre class="font-mono text-xs leading-5">{output}</pre> </Tool.Output> <Tool.Input>{input}</Tool.Input> </Tool.Call> </Tool.Content> </Tool.Root>