'use client'; import React, { useState } from 'react'; import { Wrench, ChevronDown, ChevronUp, Loader2 } from 'lucide-react'; import type { ToolCall } from '@/types/control-center'; import { cn } from '@/lib/utils'; interface ToolCallCardProps { toolCall: ToolCall; isExecuting?: boolean; } export const ToolCallCard: React.FC = ({ toolCall, isExecuting = false, }) => { const [isExpanded, setIsExpanded] = useState(false); const hasInput = toolCall.input && Object.keys(toolCall.input).length > 0; return (
{/* Header */}
hasInput && setIsExpanded(!isExpanded)} > {/* Tool Icon */}
{isExecuting ? ( ) : ( )}
{/* Tool Name */}
{toolCall.name} {isExecuting && ( Executing... )}
{!isExpanded && hasInput && (

{Object.keys(toolCall.input).length} parameter {Object.keys(toolCall.input).length !== 1 ? 's' : ''}

)}
{/* Expand/Collapse Toggle */} {hasInput && ( )}
{/* Collapsible Parameters */} {isExpanded && hasInput && (

Parameters

              {JSON.stringify(toolCall.input, null, 2)}
            
)}
); }; export default ToolCallCard;