Alwurts

Tool Invocation

AI chats 49

About

A composable card that displays an AI tool call with state icons (loading, success, error) and collapsible tool details showing arguments and results.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Tool Invocation to your project and fits it to your theme.

Code

How Tool Invocation is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import {
	ToolInvocation,
	ToolInvocationContentCollapsible,
	ToolInvocationHeader,
	ToolInvocationName,
	ToolInvocationRawData,
} from "@/components/ui/tool-invocation";

export default function ToolInvocationDemo() {
	return (
		<div className="mx-auto w-full max-w-md p-4">
			<ToolInvocation className="w-full">
				<ToolInvocationHeader>
					<ToolInvocationName
						name="search-database"
						type="output-available"
					/>
				</ToolInvocationHeader>
				<ToolInvocationContentCollapsible defaultOpen>
					<ToolInvocationRawData
						data={{ query: "magical forest stories" }}
						title="Arguments"
					/>
					<ToolInvocationRawData
						data="Found several stories about magical forests, including 'The Whispering Woods' - a tale about a magical forest where trees can talk and animals sing beautiful songs."
						title="Result"
					/>
				</ToolInvocationContentCollapsible>
			</ToolInvocation>
		</div>
	);
}

Dependencies

More by Alwurts

View all
  • Chat Input

    Chat Input

    313
  • Model Selector

    Model Selector

    46
  • Chat Suggestions

    Chat Suggestions

    15
  • Status Edge

    Status Edge

    11
  • Tool Call

    Tool Call

    6
  • Editable Handle

    Editable Handle

    4
  • JSX Renderer

    JSX Renderer

More in AI chats

View all
  • AI Actions

    AI Actions

    351
  • Aquarium Prompt

    Aquarium Prompt

    113
  • Agent Chat

    Agent Chat

    21
  • Message With Header And Delivery Status

    Message With Header And Delivery Status

    60
  • Research Report

    Research Report

    7
  • Tool Web Fetch

    Tool Web Fetch

    4
  • Color Picker

    Color Picker

    201
  • Suggestions

    Suggestions

    40