Skip to main content
Glama

think-tools

Manage MCP server connections, execute reasoning strategies, check server status, and create thought branches to enhance structured problem-solving workflows.

Instructions

Utilities for thinking workflows: connect to MCP servers, execute actions, check status, create branches

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes
serverNameNo
commandNo
argsNo
branchIdNo
branchFromThoughtNo
thoughtNo

Implementation Reference

  • Handler for 'think-tools' MCP tool. Dispatches to actions: connect-server (connect to MCP servers), execute-actions (run pending actions), server-status (check connected servers and session state), create-branch (start new branch from existing thought). Integrates with SequentialThinkingServer instance.
    async (args) => { try { switch (args.action) { case "connect-server": if (!args.serverName || !args.command) { throw new Error("serverName and command required for 'connect-server' action"); } const connectResult = await thinkingServer.connectToMCPServer( args.serverName, args.command, args.args || [] ); return { content: [{ type: "text", text: JSON.stringify({ action: "connect-server", ...connectResult }, null, 2) }] }; case "execute-actions": const execResults = await thinkingServer.executePendingActions(); return { content: [{ type: "text", text: JSON.stringify({ action: "execute-actions", executed: execResults.length, results: execResults }, null, 2) }] }; case "server-status": const status = { action: "server-status", connectedServers: thinkingServer.mcpClientManager.getConnectedServers(), pendingActions: thinkingServer.pendingActions.length, actionResults: thinkingServer.actionResults.length, currentSession: thinkingServer.sessionId, strategy: thinkingServer.strategy, absoluteThoughtNumber: thinkingServer.absoluteThoughtNumber, sequenceThoughtNumber: thinkingServer.sequenceThoughtNumber, branches: Object.keys(thinkingServer.branches), thoughtHistory: thinkingServer.thoughtHistory.length }; return { content: [{ type: "text", text: JSON.stringify(status, null, 2) }] }; case "create-branch": if (!args.branchId || !args.branchFromThought || !args.thought) { throw new Error("branchId, branchFromThought, and thought required for 'create-branch' action"); } // Find the source thought const sourceThought = thinkingServer.thoughtHistory.find( t => t.absoluteNumber === args.branchFromThought ); if (!sourceThought) { throw new Error(`No thought found with absolute number ${args.branchFromThought}`); } // Create branching thought data const branchData = { thought: args.thought, branchFromThought: args.branchFromThought, branchId: args.branchId, thoughtNumber: 1, totalThoughts: 5, // Default estimate nextThoughtNeeded: true, strategy: thinkingServer.strategy }; // Process the branch creation const branchResult = await thinkingServer.processThought(branchData); return { content: [{ type: "text", text: JSON.stringify({ action: "create-branch", message: `Branch '${args.branchId}' created from thought A${args.branchFromThought}`, branchResult: branchResult }, null, 2) }] }; default: throw new Error(`Unknown action: ${args.action}`); } } catch (error) { console.error(`ERROR: Think-tools action '${args.action}' failed:`, error); throw error; } }
  • Zod input schema defining parameters for 'think-tools'. Required 'action' enum, optional params for each sub-action like serverName for connect-server, branchId/thought/branchFromThought for create-branch.
    { action: z.enum(["connect-server", "execute-actions", "server-status", "create-branch"]), serverName: z.string().optional(), command: z.string().optional(), args: z.array(z.string()).optional(), branchId: z.string().optional(), branchFromThought: z.number().optional(), thought: z.string().optional() },
  • index.js:1739-1857 (registration)
    MCP server.tool() registration of the 'think-tools' tool with description, Zod schema, and handler function.
    server.tool( "think-tools", "Utilities for thinking workflows: connect to MCP servers, execute actions, check status, create branches", { action: z.enum(["connect-server", "execute-actions", "server-status", "create-branch"]), serverName: z.string().optional(), command: z.string().optional(), args: z.array(z.string()).optional(), branchId: z.string().optional(), branchFromThought: z.number().optional(), thought: z.string().optional() }, async (args) => { try { switch (args.action) { case "connect-server": if (!args.serverName || !args.command) { throw new Error("serverName and command required for 'connect-server' action"); } const connectResult = await thinkingServer.connectToMCPServer( args.serverName, args.command, args.args || [] ); return { content: [{ type: "text", text: JSON.stringify({ action: "connect-server", ...connectResult }, null, 2) }] }; case "execute-actions": const execResults = await thinkingServer.executePendingActions(); return { content: [{ type: "text", text: JSON.stringify({ action: "execute-actions", executed: execResults.length, results: execResults }, null, 2) }] }; case "server-status": const status = { action: "server-status", connectedServers: thinkingServer.mcpClientManager.getConnectedServers(), pendingActions: thinkingServer.pendingActions.length, actionResults: thinkingServer.actionResults.length, currentSession: thinkingServer.sessionId, strategy: thinkingServer.strategy, absoluteThoughtNumber: thinkingServer.absoluteThoughtNumber, sequenceThoughtNumber: thinkingServer.sequenceThoughtNumber, branches: Object.keys(thinkingServer.branches), thoughtHistory: thinkingServer.thoughtHistory.length }; return { content: [{ type: "text", text: JSON.stringify(status, null, 2) }] }; case "create-branch": if (!args.branchId || !args.branchFromThought || !args.thought) { throw new Error("branchId, branchFromThought, and thought required for 'create-branch' action"); } // Find the source thought const sourceThought = thinkingServer.thoughtHistory.find( t => t.absoluteNumber === args.branchFromThought ); if (!sourceThought) { throw new Error(`No thought found with absolute number ${args.branchFromThought}`); } // Create branching thought data const branchData = { thought: args.thought, branchFromThought: args.branchFromThought, branchId: args.branchId, thoughtNumber: 1, totalThoughts: 5, // Default estimate nextThoughtNeeded: true, strategy: thinkingServer.strategy }; // Process the branch creation const branchResult = await thinkingServer.processThought(branchData); return { content: [{ type: "text", text: JSON.stringify({ action: "create-branch", message: `Branch '${args.branchId}' created from thought A${args.branchFromThought}`, branchResult: branchResult }, null, 2) }] }; default: throw new Error(`Unknown action: ${args.action}`); } } catch (error) { console.error(`ERROR: Think-tools action '${args.action}' failed:`, error); throw error; } } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aaronsb/think-strategies'

If you have feedback or need assistance with the MCP directory API, please join our Discord server