UNPKG

@hauptsache.net/clickup-mcp

Version:

Search, create, and retrieve tasks, add comments, and track time through natural language commands.

45 lines (44 loc) 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ToolTester = void 0; exports.createToolTester = createToolTester; /** * A simple utility to test MCP tools directly without using the StdioServerTransport */ class ToolTester { constructor(server) { this.server = server; } /** * Test a tool by name with the provided parameters * @param toolName The name of the tool to test * @param params The parameters to pass to the tool * @returns A promise that resolves to the tool's result */ async testTool(toolName, params) { // @ts-ignore - Accessing private property for testing purposes const tools = this.server._registeredTools; if (!tools || !tools[toolName]) { throw new Error(`Tool "${toolName}" not found`); } const tool = tools[toolName]; // Validate parameters using the tool's schema try { tool.inputSchema.parse(params); } catch (error) { throw new Error(`Parameter validation error: ${error instanceof Error ? error.message : 'Unknown error'}`); } // Call the tool's callback directly with the provided parameters return await tool.callback(params); } } exports.ToolTester = ToolTester; /** * Create a tool tester for the provided server * @param server The MCP server instance * @returns A ToolTester instance */ function createToolTester(server) { return new ToolTester(server); }