import { For, refkey, StatementList } from "@alloy-js/core"; import { SwitchStatement, VarDeclaration } from "@alloy-js/typescript"; import { useMCPServerContext } from "../context/McpServer.js"; import { mcpSdk } from "../externals/mcp-sdk.js"; import { CallToolHandler } from "./CallToolHandler.jsx"; import { RequestHandler } from "./RequestHandler.jsx"; export interface CallToolHandlersProps {} /** * Generates the handler which handles tool calls. */ export function CallToolHandlers(props: CallToolHandlersProps) { const { tools } = useMCPServerContext(); const nameKey = refkey(); const argsKey = refkey(); return ( {(request) => { return ( {request}.params.name {request}.params.arguments {(tool) => } <> return {"{"} content: [{"{"} type: "text", text: "Unknown tool" {"}"}] {"}"} ); }} ); }