import { TabsContent } from "@/components/ui/tabs"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Send, AlertCircle } from "lucide-react"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Tool } from "mcp-typescript/types.js"; import { useState } from "react"; import { Label } from "@/components/ui/label"; import ListPane from "./ListPane"; const ToolsTab = ({ tools, listTools, callTool, selectedTool, setSelectedTool, toolResult, error, }: { tools: Tool[]; listTools: () => void; callTool: (name: string, params: Record) => void; selectedTool: Tool | null; setSelectedTool: (tool: Tool) => void; toolResult: string; error: string | null; }) => { const [params, setParams] = useState>({}); return ( ( <> {tool.name} {tool.description} )} title="Tools" buttonText="List Tools" />

{selectedTool ? selectedTool.name : "Select a tool"}

{error ? ( Error {error} ) : selectedTool ? (

{selectedTool.description}

{Object.entries(selectedTool.inputSchema.properties).map( ([key, value]) => (
setParams({ ...params, [key]: value.type === "number" ? Number(e.target.value) : e.target.value, }) } />
), )} {toolResult && ( <>

Tool Result:

                    {toolResult}
                  
)}
) : ( Select a tool from the list to view its details and run it )}
); }; export default ToolsTab;