"use client"; import { AnimatePresence, motion } from "framer-motion"; import { Cable, CheckCircle2, PlugZap, Search, Server, Wrench } from "lucide-react"; import { StepControls } from "@/components/visualizations/shared/step-controls"; import { useSteppedVisualization } from "@/hooks/useSteppedVisualization"; import { cn } from "@/lib/utils"; const STEPS = [ { title: "Need a New Tool", desc: "The agent starts with built-in tools, then notices this task needs an outside capability.", active: "need", }, { title: "Plug In a Server", desc: "MCP is easiest to picture as plugging a named toolbox into the agent workbench.", active: "server", }, { title: "Read the Tool Labels", desc: "The server advertises schemas, so the agent can see what each tool expects.", active: "discover", }, { title: "Name the Tools Clearly", desc: "Each external tool gets a namespaced label, which avoids collisions with built-ins.", active: "belt", }, { title: "Use It Like Any Tool", desc: "Once on the tool belt, the MCP tool follows the same call-and-result rhythm.", active: "call", }, { title: "Result Comes Back", desc: "The returned data is just another tool result for the next model turn.", active: "result", }, ] as const; const BUILT_INS = ["read_file", "edit_file", "bash"]; const SERVER_TOOLS = [ { raw: "search", namespaced: "mcp__docs__search" }, { raw: "fetch", namespaced: "mcp__docs__fetch" }, { raw: "list_sections", namespaced: "mcp__docs__list_sections" }, ]; function ToolChip({ label, active, external, }: { label: string; active?: boolean; external?: boolean; }) { return ( {label} ); } function Shelf({ title, icon, active, children, }: { title: string; icon: React.ReactNode; active: boolean; children: React.ReactNode; }) { return (
{icon} {title}
{children}
); } export default function McpToolsVisualization({ title }: { title?: string }) { const vis = useSteppedVisualization({ totalSteps: STEPS.length, autoPlayInterval: 2500 }); const step = vis.currentStep; const current = STEPS[step]; const connected = step >= 1; const discovered = step >= 2; const namespaced = step >= 3; const called = step >= 4; const returned = step >= 5; return (

{title || "MCP Tool Bridge"}

} active={current.active === "need"} >
{BUILT_INS.map((tool) => ( ))}
limited to local skills
} active={current.active === "server" || current.active === "discover"} >
docs-server
{connected ? "connected" : "offline"}
{discovered ? ( SERVER_TOOLS.map((tool) => ( )) ) : ( schemas hidden until connected )}
} active={current.active === "belt" || current.active === "call"} >
{namespaced ? ( SERVER_TOOLS.slice(0, 2).map((tool, index) => ( )) ) : ( no MCP tools on the belt )}
: } active={current.active === "call" || current.active === "result"} >
{called ? "mcp__docs__search({ query })" : "waiting for a tool call"} {returned && ( tool_result: 3 relevant docs found )}
); }