Skip to content
pandacoderz/ui

Tool

Tool call card with a status badge and collapsible input and output payloads.

Input
{
  "query": "astro islands",
  "limit": 3
}
Output
{
  "results": [
    {
      "title": "Islands architecture",
      "url": "https://docs.astro.build/en/concepts/islands/"
    },
    {
      "title": "Client directives",
      "url": "https://docs.astro.build/en/reference/directives-reference/"
    }
  ]
}

Installation

npx shadcn@latest add https://ui.spencerwueste.com/r/tool.json

Usage

import {
  Tool,
  ToolContent,
  ToolInput,
  ToolOutput,
  ToolTrigger,
} from "@/components/pandacoderz-ui/tool";
<Tool status="completed">
  <ToolTrigger name="web_search" />
  <ToolContent>
    <ToolInput payload={{ query: "astro islands" }} />
    <ToolOutput payload={result} />
  </ToolContent>
</Tool>

Payloads are stringified as JSON and highlighted with Shiki on the client.

API Reference

Tool

Prop Type Description
status "pending" | "ready" | "running" | "completed" | "error" Drives the icon, badge, and colors.
defaultOpen boolean Initial expanded state.

ToolTrigger

Prop Type Description
name string Tool name shown in the header.

ToolOutput

Prop Type Description
payload unknown Output to display.
showWhen ToolStatus[] Statuses that render output. Default ["completed"].
errorText string Message shown when status is error.