Tool call
One tool an AI agent called: its name, what it was called with and what came
back. A card that opens to show the arguments and the result, an error when
it failed, and the Approve and Deny buttons when it waits for the reader.
With tool-call-group, a run of calls folds into "Used 4 tools".

Works with no script: it is a native
details. The copy buttons on the arguments and result need Alpine and the package's script, which also keep the reader's open or closed over a re-render. See getting started.
Use it
<x-ds::tool-call name="search_docs" summary="3 results" :duration="1.24"
:arguments="$call->input" :result="$call->output" />
Arguments and results are drawn by what they are: an array or object, or a JSON string (as most model APIs send them), by the JSON viewer; other text by the code block.
A failure:
<x-ds::tool-call name="fetch_tracking" status="failed" :duration="30" error="The carrier did not answer within 30 seconds." />
Waiting for approval: open, ringed, with your buttons at the top.
<x-ds::tool-call name="send_email" status="waiting" :arguments="$call->input" id="call-{{ $call->id }}">
<x-slot:actions>
<x-ds::button size="sm" wire:click="approve('{{ $call->id }}')">Approve</x-ds::button>
<x-ds::button size="sm" variant="secondary" wire:click="deny('{{ $call->id }}')">Deny</x-ds::button>
</x-slot:actions>
</x-ds::tool-call>
A group:
<x-ds::tool-call-group>
@foreach ($step->calls as $call)
<x-ds::tool-call :name="$call->name" :status="$call->status" :result="$call->output" wire:key="call-{{ $call->id }}" />
@endforeach
</x-ds::tool-call-group>
Props
tool-call
| Prop | Type | Default | What it does |
|---|---|---|---|
name | string | required | The tool's name, as the agent called it. |
status | string | done | From the status set. waiting means it needs approval. |
summary | string | — | What it did, in a few words, beside the name. |
duration | number | — | Seconds it took: "1.2s". |
arguments | array, object, string | — | What it was called with. |
result | array, object, string | — | What it returned. |
error | string | — | Why it failed, in a danger block. |
open | bool | false | Open on first paint. One waiting for approval is always open. |
icon | string | — | A Heroicon beside the name. |
maxHeight | int | — | Lines, for the arguments and the result; the rest scrolls. |
maxNodes | int | 2000 | The most JSON nodes drawn, as the JSON viewer's. |
truncated | bool or URL | false | The host cut the result: says so, and links a URL to the whole. |
copy | bool | true | Copy buttons on the arguments and the result. |
argumentsLabel resultLabel errorLabel | string | Arguments Result Error | The sections' words. |
approvalText | string | Waiting for your approval | Above the actions, when waiting. |
truncatedText fullResultText | string | Result truncated. See the full result | The truncation note. |
statusText | array | — | [status => words]. |
Give an id when a run may call the same tool with the same arguments twice:
the viewers' ids are made from it, {id}-arguments and {id}-result.
| Slot | What it does |
|---|---|
actions | Buttons at the top of the body: under "Waiting for your approval" while it waits, or on their own (a Retry on a failure). Pass them only when there is something to decide. |
tool-call-group
| Prop | Type | Default | What it does |
|---|---|---|---|
label | string | Used :count tool|Used :count tools | The fold's words, singular and plural split by a bar. |
open | bool | false | Open on first paint. A group holding a call that waits is always open. |
statusText | array | — | [status => words]. |
The group counts the calls in it and shows the one status that matters most: waiting, then running, then failed, else done.
Accessibility
- The summary is the native disclosure button, and says the status in words before the name: "Done: search_docs 3 results 1.2s".
- The arguments and result are named scroll regions, reachable by Tab.
- An error is shown, not announced: a trace re-rendered every second would otherwise announce it each time. Say a failure that matters with a toast or agent status.
- With the script a call never closes while focus is inside it, and one that starts waiting opens even if the reader had closed it.
Don't
- Don't put Approve only in a toast. The card shows what is being approved.
- Don't pass megabytes. Cut the result on the server and pass
truncateda URL to the whole. - Don't build actions that run without the reader inside the
actionsslot: it is for their decision.
From the package repo: edit this page on GitHub.