Skip to content
Back

Tool call

One tool call in one line: a live timer, status and summary, MCP server badge, and a fold that opens to arguments (secrets masked) and output; approval and failure open on their own.

oxyn add tool-call
MCP
Dioxus
let call = ToolCall::new("ru", "grep", started_at)
    .with_kind(ToolKind::Search)
    .with_target(Target::Query("refresh_token".into()))
    .with_state(ToolCallState::Running);

rsx! {
    ToolCallRow {
        call: call,
        now: clock.now(),
        on_action: move |(id, action): (String, RowAction)| host.act(id, action),
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • The tool-call row is the most repeated element in an agent transcript: one per file read, search, command, web fetch or MCP call.
  • The user glances at it to see what the agent touched and whether it worked, opens it to check exactly what was sent and returned, and acts on it when it fails (retry, read stderr) or runs long (stop).
  • It has to be calm at rest (dozens settle per turn), legible at 16–20 px in an IDE, and loud only on failure.

When not to use

  • A turn's tool calls grouped the way a transcript reads them: use Tool stack instead.
  • The agent's task list: use Todo list instead.
  • Fourteen text-glyph loaders (braille, sand, blocks, scanner…) that settle into a check, a warning or a cross when the agent finishes, waits or fails: use Glyph loader instead.

Installation

Tool call is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add tool-call
Rust
use crate::oxyn::{ToolCallRow, RUN_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{ToolCallRow, RUN_CSS};

Usage

Dioxus · rust
let call = ToolCall::new("ru", "grep", started_at)
    .with_kind(ToolKind::Search)
    .with_target(Target::Query("refresh_token".into()))
    .with_state(ToolCallState::Running);

rsx! {
    ToolCallRow {
        call: call,
        now: clock.now(),
        on_action: move |(id, action): (String, RowAction)| host.act(id, action),
    }
}

Examples

Row

Running with a live timer.

Code
let call = ToolCall::new("ru", "grep", started_at)
    .with_kind(ToolKind::Search)
    .with_target(Target::Query("refresh_token".into()))
    .with_state(ToolCallState::Running);

rsx! {
    ToolCallRow {
        call: call,
        now: clock.now(),
        on_action: move |(id, action): (String, RowAction)| host.act(id, action),
    }
}

Card

MCP call expanded with arguments.

Input
{
  "team": "ENG",
  "title": "Refresh-token race in auth middleware",
  "api_token": ••••
}
Code
let call = ToolCall::new("ru", "grep", started_at)
    .with_kind(ToolKind::Search)
    .with_target(Target::Query("refresh_token".into()))
    .with_state(ToolCallState::Running);

rsx! {
    ToolCallRow {
        call: call,
        now: clock.now(),
        variant: "card",
        expanded: Some(true),
        on_action: move |(id, action): (String, RowAction)| host.act(id, action),
    }
}

Failed

Failure opens by itself.

Code
let call = ToolCall::new("ru", "grep", started_at)
    .with_kind(ToolKind::Search)
    .with_target(Target::Query("refresh_token".into()))
    .with_state(ToolCallState::Running);

rsx! {
    ToolCallRow {
        call: call,
        now: clock.now(),
        on_action: move |(id, action): (String, RowAction)| host.act(id, action),
    }
}

Minimal

Edit summary in one quiet line.

Code
let call = ToolCall::new("ru", "grep", started_at)
    .with_kind(ToolKind::Search)
    .with_target(Target::Query("refresh_token".into()))
    .with_state(ToolCallState::Running);

rsx! {
    ToolCallRow {
        call: call,
        now: clock.now(),
        variant: "minimal",
        on_action: move |(id, action): (String, RowAction)| host.act(id, action),
    }
}

Terminal

Terminal transcript style.

✕Ran cargo test … · 7.0s
└ Retrying in 3s · 2/3
└ exit 101 · 2 tests failed
Code
let call = ToolCall::new("ru", "grep", started_at)
    .with_kind(ToolKind::Search)
    .with_target(Target::Query("refresh_token".into()))
    .with_state(ToolCallState::Running);

rsx! {
    ToolCallRow {
        call: call,
        now: clock.now(),
        variant: "terminal",
        on_action: move |(id, action): (String, RowAction)| host.act(id, action),
    }
}

API reference

ToolCallRow

PropTypeDefaultDescription
callrequiredToolCall—The call.
nowrequiredClockMs—Shared clock.
variantString"row"`row`, `card`, `terminal` or `minimal`.
expandedOption<bool>Default::default()Expanded (`None` = the system decides: approval and failure open).
on_toggleEventHandler<String>—Header pressed.
on_actionEventHandler<(String, RowAction)>—Retry / Stop / Connect pressed.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
EnterorSpaceFold open or closed
TabInto the row's actions (retry, copy, open)

Accessibility

  • The row is a button with aria-expanded and aria-controls pointing at the detail.
  • Each state has a full name ("Running cargo test, 12 seconds", "Linear needs sign-in").
  • The MCP server is part of the name ("via Linear").
From the spec
  • Role. Row = button (aria-expanded, aria-controls → detail). Detail panes are regions labelled "Input", "Output", "Error output". Group rows use tree semantics (role="treeitem", ←/→).
  • Accessible names per state: Pending "Read auth.rs, queued"; StreamingInput "Preparing read"; AwaitingApproval "Run cargo test, waiting for your approval"; Running "Running cargo test, 12 seconds"; Succeeded "Read auth.rs, succeeded, 0.8 seconds"; Failed "Ran cargo test, failed, exit code 101"; Cancelled "Stopped cargo test after 4 seconds"; Denied "Denied: write outside workspace"; AuthNeeded "Linear needs sign-in"; RetryScheduled "Retrying in 3 seconds, attempt 2 of 3". MCP badge is part of the name ("via Linear").
  • Live region. None on the row (tools.md §8). Failures are announced once by the composer's polite region; retries announce "Retrying cargo test".
  • Keyboard. Enter / Space toggle; R retry; C copy the focused pane; Esc stop or cancel a scheduled retry; Tab moves into panes and their Copy buttons, Shift+Tab back to the row.
  • Contrast. Verb and target ≥ 4.5:1; args preview (dim) ≥ 4.5:1 in default themes (it is real text); glyphs ≥ 3:1; the error line in danger ≥ 4.5:1 on its tint.
  • Focus. 2 px ring around the full row (inset in dense lists so rows don't overlap); focus stays on the row when it expands or settles.
  • Reduced motion. §6 last row.

Motion & interaction

  • Enter. dur.row.enter (height spring + fade, y +4 → 0); burst stagger 40 ms cap 6.
  • Args stream. In StreamingInput the preview text appends left to right with no reflow of the verb (reserved slot); text-shimmer/calm sweeps it after 600 ms.
  • Start. ○ → loader crossfade 120 ms; timer slot fades in at 1 s (Width::ReserveMagnitude).
  • Settle. Loader finishes its beat, morphs to ✓ / ✕ / ■ / ⊘ (dur.row.morph), ✓ strokes once (dur.check.draw); verb rolls to past tense (dur.tense.roll 240 ms); duration freezes. The result summary fades in after the roll (120 ms).
  • Failure. ✕ + 2-cycle 3 px glyph nudge; the error line opens under the row with dur.row.enter; Retry button fades in 120 ms. The row never shakes.
  • Retry. Pressing Retry: button press scale 0.94 for 80 ms; ✕ crossfades to the loader; the error line collapses (180 ms); an attempt pill "2/3" pops in (scale 0.8 → 1, spring.snap). Agent-scheduled retries show a countdown with digits swapping each second.
  • Approval hand-off. Entering AwaitingApproval expands the detail and slides the family-G footer in from the card's bottom edge (200 ms ease.out); on approve the footer collapses into a one-line "Allowed once" note and the row continues as Running; on deny it morphs to Denied.
  • Expand / collapse. dur.expand / dur.collapse; chevron 90° in 160 ms. Expanding a row never scrolls the transcript unless the row's header would leave the viewport (then the header is kept in place, content grows downward).
  • Copy. Glyph swaps to ✓ with a scale 0.9 → 1 and 4 px blur → 0 (A JSON viewer copy feedback, note 12), reverts after 1200 ms.
  • MCP badge. On needs-auth the key glyph pops in once (scale 0 → 1, spring.snap); after a successful connect the badge dot fades out and the row re-runs (Running) without re-entering.
  • Group merge. See tools.md §5.1: the first row's label crossfades to the group label; count rolls.
  • Hover. Background tint 80 ms; tooltip after 400 ms: raw tool name, server, full target, start time, exact duration, attempt, provenance ("Ran automatically · Auto-edit", from composer-permission-selector.md).
Timing
TransitionDurationDelayEasing / springStaggerFrame rate
Row enter200 ms height + 160 ms fade0spring.snap / ease.out40 ms cap 660 Hz
○ → loader120 ms crossfade0ease.out—60 Hz
Args shimmer1400 / 800 ms600 msease.coast—30 Hz
Timer appear120 msat 1.0 sease.out—30 Hz
Decimal timer resolution100 ms———10 Hz while visible and < 10 s
Loader → glyph160 ms + 240 ms stroke≤ 200 ms beatspring.snap / ease.out—60 Hz
Verb tense roll240 msafter morphease.out—60 Hz
Success tone hold → icon600 ms + 240 ms—ease.in—30 Hz
Error line open200 msafter nudgespring.snap—60 Hz
Error nudge300 ms, 2 × 3 pxafter morphlinear—60 Hz
Retry press / pill pop80 ms / 160 ms0ease.out / spring.snap—60 Hz
Approval footer in / resolve200 ms / 220 ms0ease.out / spring.snap—60 Hz
Expand / collapse220 ms / 280 ms0spring.snap / ease.in—60 Hz
Chevron rotate160 ms0ease.out—60 Hz
Copy ✓ / revert160 ms / after 1200 ms0spring.snap—60 Hz
Tooltip120 ms400 msease.out—60 Hz
Reduced motion80 ms opacity crossfades for every change; instant heights; no shimmer, no nudge, no stroke draw, no pill pop; timer and countdown digits swap—linearnone1 Hz idle

Responsive behaviour

  • minimal suits narrow side panels; card suits full-width transcripts; terminal suits TUIs.
Edge cases (spec)
  • Very fast calls. Inside delay.row_guard (150 ms) the row renders final: no ○, no loader, no tense roll (it enters in past tense).
  • Very slow calls. Units timer; stall overlay at tool_stall 120 s; Stop stays available.
  • Huge arguments (pasted files, base64): preview shows {…} / "…" (48 KB); Input pane shows 12 lines then "Show all (84 lines)"; binary or > 1 MB values show size + "Download".
  • Huge output. Output pane renders 200 lines, then "Open full output" (opens a panel or file); JSON trees page arrays over 100 items.
  • Streaming JSON args that never close. The preview keeps the last parsable state; the Input pane shows raw text with a "partial" tag.
  • Error with no stderr. The error line shows the protocol error kind ("Timed out after 30s", "Tool error"); never an empty line.
  • Exit codes that are not failures. Per-kind ok_exit_codes: search exit 1 = "No matches" (neutral, Codex's rule, note 08).
  • Unknown tool names. Generic kind, raw name shown in mono, JSON detail.
  • MCP server disappears mid-call. Row → Failed { kind: Protocol }, badge shows failed; Retry is disabled with reason "Server disconnected" until it reconnects.
  • Retry after the run ended. Retry runs the call again as a new user-initiated turn (the adapter decides); if unsupported, Retry shows Disabled("Run ended") with the reason in its tooltip.
  • Long targets / RTL. Middle-truncation for paths, LTR isolates for paths and code in RTL layouts; row mirrors.
  • Tiny sizes. At 16–20 px: icon + verb only (terse pack), duration and badge on hover, error as a ✕ glyph with the line below.
  • Touch. Whole row toggles; Retry / Stop are 44 px trailing buttons; Copy appears in the expanded panes, not on hover.
  • Offline. Running rows freeze with the stall overlay; Retry disabled with "Offline".

Notes for AI

  • Import ToolCallRow from oxyn_dioxus and include RUN_CSS plus the token stylesheet once.
  • A GPUI version exists: ToolCallRowEl in oxyn_gpui.
  • Props to set first: call, now.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI