Tool Calls

A small “3 tools used” line under an AI reply. Click it to see each step the agent took and whether it's still running, finished or failed.

Preview

Setup

Install with the shadcn CLI

$npx shadcn@latest add https://kinetikui.singhgourav.site/r/tool-calls.json

One command adds every file, the npm packages and any Kinetik components it builds on. Needs a components.json; the CLI offers to create one if your project has none.

Or install manually

  1. 1

    Run in your terminal:

    $npm install clsx tailwind-merge framer-motion lucide-react
  2. 2

    Copy lib/utils.ts from the Code tab. Skip if you already have cn().

  3. 3

    Copy styles/tokens.css from the Code tab and import it in your global CSS after Tailwind: @import "./styles/tokens.css";

  4. 4

    Create a components/ui/tool-calls/ folder and copy every file from the Code tab into it. Each file does one job, so you can read or change a piece without the rest.

  5. 5

    Import and render:

    Example
    import { ToolCalls } from "@/components/ui/tool-calls"
    
    <ToolCalls calls={["Searched customers", "Sorted by size"]} />

Usage

The simplest version is a list of names. They all show as done:

Example
import { ToolCalls } from "@/components/ui/tool-calls"

<ToolCalls calls={["Searched customers", "Sorted by employees"]} />

To show progress while your agent works, pass objects with a status. While anything is still running, the line reads “Using 2 tools…” instead of “2 tools used”:

Example
<ToolCalls
  calls={[
    { name: "Searched customers", status: "done" },
    { name: "Read 3 contracts", status: "running", detail: "Vertex, Apex and Elevate" },
  ]}
/>
StatusShows
"running"A spinner
"done"A green check
"error"A red cross

Put it right above the reply text. Pass defaultOpen to show the list open, and icon to use your own icon instead of the sparkle.

Props

PropTypeDefaultWhat it does
calls(string | ToolCall)[]—Each step: a name, or { name, status, detail }.
defaultOpenbooleanfalseStart with the list open.
iconReactNodesparkleIcon before the summary.

Accessibility

  • The summary is a button that says whether the list is open (aria-expanded)
  • Each status icon has a label: Running, Done or Failed