UNPKG

think-tool-mcp

Version:

An MCP server implementing the think tool for Claude and other LLMs

43 lines 1.68 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); jest.mock('@modelcontextprotocol/sdk/server/mcp.js', () => { class McpServerMock { constructor(_opts) { this.tools = {}; } tool(name, description, schema, handler) { this.tools[name] = { description, schema, handler }; } async connect(_transport) { return; } } return { McpServer: McpServerMock }; }); jest.mock('@modelcontextprotocol/sdk/server/stdio.js', () => { class StdioServerTransportMock { } return { StdioServerTransport: StdioServerTransportMock }; }); const server_1 = require("../server"); describe('ThinkToolServer', () => { test('registers think tool with proper handler', async () => { const server = new server_1.ThinkToolServer('test-think-tool'); const mcp = server.mcp; expect(mcp.tools).toBeDefined(); expect(Object.keys(mcp.tools)).toContain('think'); const { handler } = mcp.tools['think']; const longThought = 'x'.repeat(60); const shortThought = 'hello world'; const longRes = await handler({ thought: longThought }); const shortRes = await handler({ thought: shortThought }); expect(longRes.content[0].text).toMatch(/^Thought: x{50}\.\.\.$/); expect(shortRes.content[0].text).toBe('Thought: hello world'); }); test('run connects using stdio transport', async () => { const server = new server_1.ThinkToolServer('test'); // Should not throw await expect(server.run()).resolves.toBeUndefined(); }); }); //# sourceMappingURL=server.test.js.map