Skip to main content
Glama

think

Breaks complex tasks into manageable steps, tracks progress, and recommends tools for agentic problem-solving. Logs each thought in a thread to ensure clarity, self-correction, and iterative refinement for efficient task execution.

Instructions

Logs a single step in a thought process for agentic problem-solving. Supports thread following, step-tracking, self-correction, and tool recommendations. For each new user message, begin a new thought thread and log each thought after each completed step.

Key functionalities

Agentic Workflow Orchestration: Guides through complex tasks by breaking them into precise, manageable, traceable steps. Automatic smart thinking process: Avoids over-questionning users about their intention and just figures it out how to proceed. Iterative Refinement: Assesses success of each step and self-corrects if necessary, adapting to new information or errors (failure, empty results, etc). Tool Recommendation: Suggests relevantly specific available tools (`tool_recommendation`) to execute planned actions or gather necessary information. Proactive Planning: Utilizes `left_to_be_done` for explicit future state management and task estimation.

Args: thread_purpose: A concise, high-level objective or thematic identifier for the current thought thread. Essential for organizing complex problem-solving trajectories. thought: The detailed, atomic unit of reasoning or action taken by the AI agent at the current step. This forms the core of the agent's internal monologue. thought_index: A monotonically increasing integer representing the sequence of thoughts within a specific thread_purpose. Crucial for chronological tracking and revision targeting. tool_recommendation: A precise actionable suggestion for the next tool to be invoked, omitted if no tool is needed, directly following the current thought. left_to_be_done: A flexible forward-looking statement outlining the next steps or sub-goals to be completed within the current thread_purpose. Supports multi-step planning and progress tracking. Omitted if no further action is needed.

Returns: A confirmation that the thought has been logged.

Example of thought process

  1. user: "I keep hearing about central banks, but I don't understand what they are and how they work."

  2. think(thread_purpose="Central banks explained", thought="Requires information about central banks and how they work. Consider using <named_tool> tool.", thought_index=1, tool_recommendation="<named_tool>", left_to_be_done="Summarize the findings and create an exhaustive graph representation")

  3. call <named_tool>

  4. think(thread_purpose="Central banks explained", thought="Summary of the findings is clear and exhaustive, I have enough information. Must create the graph with <named_tool>.", thought_index=2, tool_recommendation="<named_tool>", left_to_be_done="Send summary and graph to the user")

  5. call <named_tool>

  6. final: respond with summary and graph (no need to call think since left_to_be_done is a simple final step)

Input Schema

NameRequiredDescriptionDefault
left_to_be_doneNoNone
thoughtYes
thought_indexYes
thread_purposeYes
tool_recommendationNoNone

Input Schema (JSON Schema)

{ "properties": { "left_to_be_done": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": "None", "title": "Left To Be Done" }, "thought": { "title": "Thought", "type": "string" }, "thought_index": { "title": "Thought Index", "type": "integer" }, "thread_purpose": { "title": "Thread Purpose", "type": "string" }, "tool_recommendation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": "None", "title": "Tool Recommendation" } }, "required": [ "thread_purpose", "thought", "thought_index" ], "type": "object" }

Implementation Reference

  • The core handler function for the 'think' tool. It is decorated with @mcp.tool() for registration and implements the logging of sequential thoughts, tool recommendations, and task planning. The function signature defines the input schema.
    @mcp.tool() def think( thread_purpose: str, thought: str, thought_index: int, tool_recommendation: str | None = "None", left_to_be_done: str | None = "None", ) -> str: """Logs a thought step for agentic problem-solving, tracking reasoning, tools, and future plans. Start a new thread for each user message. # Capabilities - Workflow Orchestration: Breaks complex tasks into manageable steps. - Iterative Refinement: Self-corrects based on new info or errors. - Tool Recommendation: Suggests specific tools for the next action. - Forward Planning: Tracks remaining tasks via `left_to_be_done`. Args: thread_purpose: Short objective/topic for the thread. thought: Current reasoning or action description. thought_index: Monotonically increasing step number (1, 2, 3...). tool_recommendation: Tool to call next, or 'None'. left_to_be_done: Remaining steps/sub-goals, or 'None'. Returns: Confirmation of log. # Example 1) User: "I keep hearing about central banks, but I don't understand what they are and how they work." 2) think( thread_purpose="Explain Central Banks", thought="The user needs a comprehensive explanation of central banks. I need to identify their core definition, key roles (monetary policy, financial stability, currency issuance), and operational mechanisms (interest rates, reserves). I should search for a structured overview to ensure I don't miss major aspects like the Federal Reserve or ECB as examples.", thought_index=1, tool_recommendation="search_web", left_to_be_done="1. Search for 'how central banks work' and key functions. 2. Synthesize findings into a clear explanation. 3. Create a visual graph of the banking system structure if possible. 4. Present final answer." ) 3) call search_web(query="how central banks work and their main functions") 4) think( thread_purpose="Explain Central Banks", thought="Search results clarify that central banks manage currency stability, control inflation via interest rates, and act as lenders of last resort. I have enough textual information. Now, to make this easier to understand, I should create a graph representing the flow of money and influence between the central bank, commercial banks, and the economy.", thought_index=2, tool_recommendation="create_graph", left_to_be_done="Create a graph showing Central Bank -> Commercial Banks -> Public/Economy relations." ) 5) call create_graph(data=...) 6) Final Response: "Here is an explanation of central banks..." (Task complete, no further think call needed). """ log = f"Thread purpose: {thread_purpose}\nThought {thought_index} logged." if tool_recommendation and tool_recommendation.lower() != "none": log += f" Recommended tool: {tool_recommendation}." extra_log = f"{log}\nThought: {thought}" if left_to_be_done and left_to_be_done.lower() != "none": extra_log += f"\nNext: {left_to_be_done}" logger.info(extra_log) return log
  • Creation of the FastMCP server instance where tools like 'think' are registered.
    mcp: FastMCP[Any] = FastMCP("Sequential Thinking")
  • Input schema defined by the function parameters of the 'think' tool.
    def think( thread_purpose: str, thought: str, thought_index: int, tool_recommendation: str | None = "None", left_to_be_done: str | None = "None", ) -> str:

Other Tools

Related Tools

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/philogicae/sequential-thinking-mcp'

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