Skip to main content
Glama
ThinkFar

Clear Thought Server

sequentialthinking

Analyze complex problems through adaptive thinking steps that build on, question, or revise previous insights as understanding deepens.

Instructions

A detailed tool for dynamic and reflective problem-solving through thoughts. This tool helps analyze problems through a flexible thinking process that can adapt and evolve. Each thought can build on, question, or revise previous insights as understanding deepens.

When to use this tool:

  • Breaking down complex problems into steps

  • Planning and design with room for revision

  • Analysis that might need course correction

  • Problems where the full scope might not be clear initially

  • Problems that require a multi-step solution

  • Tasks that need to maintain context over multiple steps

  • Situations where irrelevant information needs to be filtered out

You should:

  1. Start with an initial estimate of needed thoughts, but be ready to adjust

  2. Feel free to question or revise previous thoughts

  3. Don't hesitate to add more thoughts if needed, even at the "end"

  4. Express uncertainty when present

  5. Mark thoughts that revise previous thinking or branch into new paths

  6. Ignore information that is irrelevant to the current step

  7. Generate a solution hypothesis when appropriate

  8. Verify the hypothesis based on the Chain of Thought steps

  9. Repeat the process until satisfied with the solution

  10. Provide a single, ideally correct answer as the final output

  11. Only set next_thought_needed to false when truly done and a satisfactory answer is reached

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thoughtYes
thoughtNumberYes
totalThoughtsYes
nextThoughtNeededYes
isRevisionNo
revisesThoughtNo
branchFromThoughtNo
branchIdNo
needsMoreThoughtsNo

Implementation Reference

  • The main handler method for the sequentialthinking tool. Validates input, stores the thought in history or branches, formats and logs a colored output to console showing thought progress, and returns the validated ThoughtData.
    public processThought(input: unknown): ThoughtData {
      const validatedInput = this.validateThoughtData(input);
      
      // Store the thought for future reference
      this.storeThought(validatedInput);
      
      // Log formatted output to console
      const formattedOutput = this.formatThoughtOutput(validatedInput);
      console.error(formattedOutput);
      
      return validatedInput;
    }
  • Tool definition including name, description, and inputSchema (JSON schema for validation) for the sequentialthinking tool.
    const SEQUENTIAL_THINKING_TOOL: Tool = {
        name: "sequentialthinking",
        description: `A detailed tool for dynamic and reflective problem-solving through thoughts.
    This tool helps analyze problems through a flexible thinking process that can adapt and evolve.
    Each thought can build on, question, or revise previous insights as understanding deepens.
    
    When to use this tool:
    - Breaking down complex problems into steps
    - Planning and design with room for revision
    - Analysis that might need course correction
    - Problems where the full scope might not be clear initially
    - Problems that require a multi-step solution
    - Tasks that need to maintain context over multiple steps
    - Situations where irrelevant information needs to be filtered out
    
    You should:
    1. Start with an initial estimate of needed thoughts, but be ready to adjust
    2. Feel free to question or revise previous thoughts
    3. Don't hesitate to add more thoughts if needed, even at the "end"
    4. Express uncertainty when present
    5. Mark thoughts that revise previous thinking or branch into new paths
    6. Ignore information that is irrelevant to the current step
    7. Generate a solution hypothesis when appropriate
    8. Verify the hypothesis based on the Chain of Thought steps
    9. Repeat the process until satisfied with the solution
    10. Provide a single, ideally correct answer as the final output
    11. Only set next_thought_needed to false when truly done and a satisfactory answer is reached`,
        inputSchema: {
            type: "object",
            properties: {
                thought: { type: "string" },
                thoughtNumber: { type: "number", minimum: 1 },
                totalThoughts: { type: "number", minimum: 1 },
                nextThoughtNeeded: { type: "boolean" },
                isRevision: { type: "boolean" },
                revisesThought: { type: "number", minimum: 1 },
                branchFromThought: { type: "number", minimum: 1 },
                branchId: { type: "string" },
                needsMoreThoughts: { type: "boolean" },
            },
            required: [
                "thought",
                "thoughtNumber",
                "totalThoughts",
                "nextThoughtNeeded",
            ],
        },
    };
  • TypeScript interface definition for ThoughtData, which defines the structure used for input validation and output of the sequentialthinking tool.
    export interface ThoughtData {
        thought: string;
        thoughtNumber: number;
        totalThoughts: number;
        isRevision?: boolean;
        revisesThought?: number;
        branchFromThought?: number;
        branchId?: string;
        needsMoreThoughts?: boolean;
        nextThoughtNeeded: boolean;
    }
  • src/index.ts:1033-1045 (registration)
    Registration in the CallToolRequestHandler switch statement: handles tool calls to 'sequentialthinking' by invoking the processThought method on the server instance and returning JSON stringified result.
    case "sequentialthinking": {
        const result = thinkingServer.processThought(
            request.params.arguments
        );
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(result, null, 2),
                },
            ],
        };
    }
  • src/index.ts:997-1009 (registration)
    Tool registration in the MCP server capabilities declaration, associating 'sequentialthinking' with its Tool object.
    tools: {
        sequentialthinking: SEQUENTIAL_THINKING_TOOL,
        mentalmodel: MENTAL_MODEL_TOOL,
        designpattern: DESIGN_PATTERN_TOOL,
        programmingparadigm: PROGRAMMING_PARADIGM_TOOL,
        debuggingapproach: DEBUGGING_APPROACH_TOOL,
        collaborativereasoning: COLLABORATIVE_REASONING_TOOL,
        decisionframework: DECISION_FRAMEWORK_TOOL,
        metacognitivemonitoring: METACOGNITIVE_MONITORING_TOOL,
        scientificmethod: SCIENTIFIC_METHOD_TOOL,
        structuredargumentation: STRUCTURED_ARGUMENTATION_TOOL,
        visualreasoning: VISUAL_REASONING_TOOL,
    },
  • Helper method for runtime input validation, enforcing the schema and constructing a typed ThoughtData object, throwing errors on invalid input.
    private validateThoughtData(input: unknown): ThoughtData {
      const data = input as Record<string, unknown>;
    
      if (!data.thought || typeof data.thought !== 'string') {
        throw new Error('Invalid thought: must be a string');
      }
      if (!data.thoughtNumber || typeof data.thoughtNumber !== 'number') {
        throw new Error('Invalid thoughtNumber: must be a number');
      }
      if (!data.totalThoughts || typeof data.totalThoughts !== 'number') {
        throw new Error('Invalid totalThoughts: must be a number');
      }
      if (typeof data.nextThoughtNeeded !== 'boolean') {
        throw new Error('Invalid nextThoughtNeeded: must be a boolean');
      }
    
      // Optional fields
      const isRevision = data.isRevision !== undefined ? !!data.isRevision : undefined;
      const revisesThought = data.revisesThought !== undefined && typeof data.revisesThought === 'number' 
        ? data.revisesThought as number 
        : undefined;
      const branchFromThought = data.branchFromThought !== undefined && typeof data.branchFromThought === 'number' 
        ? data.branchFromThought as number 
        : undefined;
      const branchId = data.branchId !== undefined && typeof data.branchId === 'string' 
        ? data.branchId as string 
        : undefined;
      const needsMoreThoughts = data.needsMoreThoughts !== undefined ? !!data.needsMoreThoughts : undefined;
    
      return {
        thought: data.thought as string,
        thoughtNumber: data.thoughtNumber as number,
        totalThoughts: data.totalThoughts as number,
        nextThoughtNeeded: data.nextThoughtNeeded as boolean,
        isRevision,
        revisesThought,
        branchFromThought,
        branchId,
        needsMoreThoughts
      };
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does an excellent job explaining behavioral traits. It describes the iterative nature ('Each thought can build on, question, or revise previous insights'), the adaptive process ('ready to adjust'), and specific behavioral expectations through the 11-point list (e.g., 'Mark thoughts that revise previous thinking', 'Only set next_thought_needed to false when truly done'). This provides substantial behavioral context beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, when to use, numbered guidelines) but is overly verbose at 11 numbered points. Some points could be consolidated (e.g., points about revision could be combined), and the 'When to use' section has redundant items ('Problems that require a multi-step solution' and 'Tasks that need to maintain context over multiple steps' are similar). The information is valuable but not optimally concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with 9 parameters, 0% schema coverage, no annotations, and no output schema, the description provides excellent behavioral guidance but critically lacks parameter explanations. The purpose and usage guidelines are strong, but the agent would struggle to understand how to properly use the 9 parameters based solely on this description. The behavioral transparency helps but doesn't fully compensate for the parameter documentation gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 9 parameters, the description provides almost no parameter-specific information. While it mentions concepts like 'thought', 'revise previous thinking', and 'next_thought_needed' in the behavioral guidance, it doesn't explain what individual parameters mean, their relationships, or how they should be used together. The description fails to compensate for the complete lack of schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'dynamic and reflective problem-solving through thoughts' and 'analyze problems through a flexible thinking process', which is specific and actionable. However, it doesn't explicitly differentiate from sibling tools like 'collaborativereasoning' or 'structuredargumentation', which might also involve multi-step reasoning processes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides an explicit 'When to use this tool' section with 7 specific scenarios (e.g., 'Breaking down complex problems into steps', 'Planning and design with room for revision'), giving clear guidance on appropriate contexts. It doesn't mention when NOT to use it or name specific alternatives, but the detailed usage scenarios provide strong directional guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/ThinkFar/clear-thought-mcp'

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