/** * Tool testing helper - helps test MCP tools */ import { mcpServer } from "../../src/server.js"; import type { ToolHandler } from "../../src/server.js"; /** * Call a tool by name with arguments */ export async function callTool( toolName: string, args: Record ): Promise<{ content: Array<{ type: string; text: string }>; isError?: boolean; }> { // Get the tool handler from the server const tools = mcpServer.getTools(); const toolEntry = tools.get(toolName); if (!toolEntry) { throw new Error(`Tool ${toolName} not found`); } return await toolEntry.handler(args); } /** * Get all registered tools */ export function getRegisteredTools(): string[] { const tools = mcpServer.getTools(); return Array.from(tools.keys()); }