Components

ToolCallCard

Displays a single agent tool invocation with its name, arguments, and execution status.

Category: AI / Chat / Standalone

Import

import {
  ToolCallCard,
  type ToolCallCardProps,
  type ToolCallStatus,
} from "@hareru/ui"

Exports

NameTypeDescription
ToolCallCardComponentTool call display card
ToolCallCardPropsTypeProps interface
ToolCallStatusType"pending" | "executing" | "done" | "error"

Key Props

PropTypeDefaultDescription
toolNamestringTool name (required)
statusToolCallStatusExecution status (required)
argsRecord<string, unknown> | stringTool arguments (object or partial JSON string for streaming)
argsStreamingbooleanfalseWhether args are still streaming
resultReactNodeExecution result
errorstringError message
durationnumberExecution duration in ms (shown when status is "done")
collapsiblebooleantrueWhether the body section is collapsible
defaultExpandedbooleanfalseInitial expanded state

States

StateTypeValuesDefaultCSS Reflection
statusenumpending | executing | done | errorpending

Accessibility

  • ARIA attributes: aria-expanded, aria-label
  • Keyboard:
    • Tab to navigate tool details
    • Enter to expand/collapse

Usage

import { ToolCallCard } from "@hareru/ui"

// Executing
<ToolCallCard
  toolName="search_documents"
  status="executing"
  args={{ query: "quarterly revenue", limit: 10 }}
/>

// Completed with result and duration
<ToolCallCard
  toolName="search_documents"
  status="done"
  args={{ query: "quarterly revenue", limit: 10 }}
  result={<span>Found 3 documents</span>}
  duration={245}
  defaultExpanded
/>

// Error state
<ToolCallCard
  toolName="search_documents"
  status="error"
  args={{ query: "quarterly revenue" }}
  error="Connection timeout"
/>

// Streaming args
<ToolCallCard
  toolName="run_query"
  status="executing"
  args='{"sql": "SELECT * FROM'
  argsStreaming
/>

Notes

  • Status icons: pending, executing, done, error.
  • When collapsible is true (default), args/result/error are hidden behind a toggle button.
  • args accepts both an object (displayed as formatted JSON) and a raw string (for streaming partial JSON).
  • The error message is rendered with role="alert".

On this page