What an assistant's tools did, one past-tense row each ("Searched the web · 8 sources"), opening to what they read; several fold under one line.
3 tool calls · 3 sources
Searched the web for “passkey adoption”3 sources
- Passkey adoption reportidentity-research.example
- Why people still pick passwordsux-quarterly.example
- Synced passkeys and recoverystandards-notes.example.org
Read 3 pages3 sources
- Passkey adoption reportidentity-research.example
- Why people still pick passwordsux-quarterly.example
- Synced passkeys and recoverystandards-notes.example.org
Searched recent events4 results
Input{ "query": "Acme" }Result[4 events]
import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { sx } from "./ui/uicontext/components/Sx.ts"import type { Citation } from "./ui/uicontext/components/kit/Cite.ts"import { type ToolCall, ToolCallRow, ToolCalls } from "./ui/uicontext/components/kit/ToolCall.ts"import { space } from "./ui/uicontext/components/tokens.stylex.ts"const source = (n: number, title: string, host: string): Citation => ({ id: `s${n}`, label: String(n), title, href: `https://${host}/`, source: host })const sources = [ source(1, "Passkey adoption report", "identity-research.example"), source(2, "Why people still pick passwords", "ux-quarterly.example"), source(3, "Synced passkeys and recovery", "standards-notes.example.org"),]const finished: ReadonlyArray<ToolCall> = [ { id: "a", tool: "web", title: "Searched the web for “passkey adoption”", status: "succeeded", sources }, { id: "b", tool: "read", title: "Read 3 pages", status: "succeeded", sources }, { id: "c", tool: "calendar", title: "Searched recent events", status: "succeeded", summary: "4 results", input: "{ \"query\": \"Acme\" }", result: "[4 events]" },]const styles = stylex.create({ frame: { display: "grid", gap: space.lg, width: "min(100%, 34rem)" } })export const ToolCallDemo = Html.component({ name: "ToolCallDemo", model: Schema.Struct({}), message: Schema.Never }).make({ init: () => ({}), update: {}, view: (h) => h.div.attrs(sx(styles.frame)).children( ToolCalls(h, { calls: finished, key: "done" }), ToolCallRow(h, { id: "d", tool: "mail", title: "Searched messages", active: "Searching messages", status: "running" }, { key: "live" }), ),})Installation
pnpm dlx shadcn@latest add checkfu/uicontext/tool-callUsage
import { type ToolCall, ToolCalls } from "./ui/uicontext/components/kit/ToolCall.ts"export const AnswerTools = <M>(h: Html.H<M>, calls: ReadonlyArray<ToolCall>, answer: string) => ToolCalls(h, { calls, key: answer })API reference
Options
| Name | Type | Description |
|---|---|---|
callsrequired | ToolCall[] | — |
key | string | Names this list's rows among others in the same view |
label | string | The list's accessible name; "Tool calls" by default |
Accessibility
- Each call is a native disclosure: Enter or Space on its row shows the sources it read, each a link that opens in a new tab.
- A running call's words are a polite live region, so the change from “Searching” to “Searched” is heard once, not every frame.
- The sweep of light over a running call stops under reduced motion; the words still say it's running.