UNPKG

think-tool-mcp

Version:

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

40 lines (39 loc) 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ThinkToolServer = void 0; const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js"); const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js"); const zod_1 = require("zod"); class ThinkToolServer { constructor(serverName = "think-tool") { // Initialize MCP server this.mcp = new mcp_js_1.McpServer({ name: serverName, version: "0.1.0" }); // Register tools this.registerTools(); } registerTools() { // Register the think tool this.mcp.tool("think", `Use this tool to think about something. It will not obtain new information or change anything. Use it when complex reasoning is needed. Args: thought: A thought to think about. This can be structured reasoning, step-by-step analysis, policy verification, or any other mental process that helps with problem-solving.`, { thought: zod_1.z.string() }, async ({ thought }) => { // Return a confirmation return { content: [{ type: "text", text: thought.length > 50 ? `Thought: ${thought.substring(0, 50)}...` : `Thought: ${thought}` }] }; }); } async run() { const serverTransport = new stdio_js_1.StdioServerTransport(); await this.mcp.connect(serverTransport); } } exports.ThinkToolServer = ThinkToolServer; //# sourceMappingURL=server.js.map