Skip to main content
Glama
fmangot

Sequential Thinking MVP Server

by fmangot

sequential_thinking

Break down complex problems into manageable steps for structured analysis. Track reasoning progress, revise previous steps, and explore alternative paths to solve challenging problems systematically.

Instructions

Facilitates a detailed, step-by-step thinking process for problem-solving and analysis. Break down complex problems into manageable steps, revise and refine thoughts as understanding deepens, and branch into alternative paths of reasoning.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thoughtYesThe current reasoning step or thought in the sequence
nextThoughtNeededYesIndicates whether additional reasoning steps are required after this one
thoughtNumberYesThe sequential number of this thought (e.g., 1, 2, 3...)
totalThoughtsYesEstimated total number of thoughts needed to complete the reasoning
isRevisionNoMarks this thought as a reconsideration or refinement of a previous step
revisesThoughtNoThe thought number being revised (required if isRevision is true)
branchFromThoughtNoThe thought number from which this alternative reasoning path branches
branchIdNoUnique identifier for this alternative reasoning branch
needsMoreThoughtsNoSignals that the total number of thoughts needs to be expanded

Implementation Reference

  • Specific handler logic for the 'sequential_thinking' tool call, which invokes SequentialThinkingManager.addThought and returns the result as JSON.
    case 'sequential_thinking': {
      const input = args as ThoughtInput;
      const result = thinkingManager.addThought(input);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • JSON schema definition for the 'sequential_thinking' tool inputs and metadata.
    export const SEQUENTIAL_THINKING_TOOL: Tool = {
      name: 'sequential_thinking',
      description: 'Facilitates a detailed, step-by-step thinking process for problem-solving and analysis. Break down complex problems into manageable steps, revise and refine thoughts as understanding deepens, and branch into alternative paths of reasoning.',
      inputSchema: {
        type: 'object',
        properties: {
          thought: {
            type: 'string',
            description: 'The current reasoning step or thought in the sequence',
          },
          nextThoughtNeeded: {
            type: 'boolean',
            description: 'Indicates whether additional reasoning steps are required after this one',
          },
          thoughtNumber: {
            type: 'number',
            description: 'The sequential number of this thought (e.g., 1, 2, 3...)',
          },
          totalThoughts: {
            type: 'number',
            description: 'Estimated total number of thoughts needed to complete the reasoning',
          },
          isRevision: {
            type: 'boolean',
            description: 'Marks this thought as a reconsideration or refinement of a previous step',
          },
          revisesThought: {
            type: 'number',
            description: 'The thought number being revised (required if isRevision is true)',
          },
          branchFromThought: {
            type: 'number',
            description: 'The thought number from which this alternative reasoning path branches',
          },
          branchId: {
            type: 'string',
            description: 'Unique identifier for this alternative reasoning branch',
          },
          needsMoreThoughts: {
            type: 'boolean',
            description: 'Signals that the total number of thoughts needs to be expanded',
          },
        },
        required: ['thought', 'nextThoughtNeeded', 'thoughtNumber', 'totalThoughts'],
      },
    };
  • src/index.ts:32-39 (registration)
    MCP server request handler registration for listing tools (includes sequential_thinking via ALL_TOOLS) and handling tool calls.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools: ALL_TOOLS };
    });
    
    // Handle tool calls
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      return handleToolCall(request.params, thinkingManager);
    });
  • Core implementation of adding a thought to the sequence, including validation, branching, revisions, session management, and response generation.
    public addThought(input: ThoughtInput, sessionId?: string): ThoughtResponse {
      // Validate input
      validateThoughtInput(input);
    
      const sid = sessionId || this.currentSessionId;
      let session = this.sessions.get(sid);
    
      if (!session) {
        this.initializeSession(sid);
        session = this.sessions.get(sid)!;
      }
    
      const storedThought: StoredThought = {
        ...input,
        timestamp: Date.now(),
        sessionId: sid,
      };
    
      // Handle branching
      if (input.branchId && input.branchFromThought !== undefined) {
        let branchThoughts = session.branches.get(input.branchId);
        if (!branchThoughts) {
          branchThoughts = [];
          session.branches.set(input.branchId, branchThoughts);
        }
        branchThoughts.push(storedThought);
      } else {
        // Regular thought in main sequence
        session.thoughts.push(storedThought);
      }
    
      session.updatedAt = Date.now();
    
      // Build response message
      let message = `Thought ${input.thoughtNumber}`;
      if (input.isRevision && input.revisesThought !== undefined) {
        message += ` (revising thought ${input.revisesThought})`;
      }
      if (input.branchId) {
        message += ` [branch: ${input.branchId}]`;
      }
      message += `: ${input.thought}`;
    
      return {
        success: true,
        thoughtNumber: input.thoughtNumber,
        message,
        sequence: session.thoughts,
        totalThoughts: input.totalThoughts,
      };
    }
  • Shared handler function that routes tool calls to the appropriate logic, providing the SequentialThinkingManager instance.
    export async function handleToolCall(
      params: { name: string; arguments?: unknown },
      thinkingManager: SequentialThinkingManager
    ) {
      const { name, arguments: args = {} } = params;
    
      try {
        switch (name) {
          case 'sequential_thinking': {
            const input = args as ThoughtInput;
            const result = thinkingManager.addThought(input);
    
            return {
              content: [
                {
                  type: 'text',
                  text: JSON.stringify(result, null, 2),
                },
              ],
            };
          }
    
          case 'get_thought_sequence': {
            const { sessionId } = args as { sessionId?: string };
            const sequence = thinkingManager.getSequence(sessionId);
    
            return {
              content: [
                {
                  type: 'text',
                  text: JSON.stringify(
                    {
                      sessionId: sessionId || thinkingManager.getCurrentSessionId(),
                      thoughtCount: sequence.length,
                      thoughts: sequence,
                    },
                    null,
                    2
                  ),
                },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the tool's function but lacks critical details: it doesn't mention if this tool creates, updates, or retrieves data; what the output looks like; or any side effects like persistence or session management. This is a significant gap for a tool with 9 parameters and no output schema.

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

Conciseness4/5

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

The description is concise and well-structured in two sentences, front-loaded with the core purpose. Every sentence adds value by explaining the tool's role and key features. However, it could be slightly more efficient by integrating the second sentence's details into the first without losing clarity.

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

Completeness2/5

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

Given the complexity (9 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain what the tool returns, how it interacts with sibling tools, or the behavioral implications of using it. For a tool that likely manages state or sessions, this lack of context makes it inadequate for an agent to use effectively without trial and error.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents all 9 parameters. The description adds no specific parameter information beyond implying a sequential process. It mentions 'step-by-step' and 'branch into alternative paths,' which loosely relate to parameters like 'thoughtNumber' and 'branchId,' but doesn't provide additional syntax or usage context. Baseline 3 is appropriate as the schema does the heavy lifting.

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: 'Facilitates a detailed, step-by-step thinking process for problem-solving and analysis.' It specifies the verb 'facilitates' and the resource 'thinking process,' and outlines key actions like breaking down problems and branching reasoning. However, it doesn't explicitly differentiate from sibling tools like 'get_thought_sequence' or 'reset_thinking_session,' which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus its siblings. It mentions general activities like 'problem-solving and analysis' but doesn't specify contexts, prerequisites, or alternatives. For example, it doesn't clarify if this is for initiating a session versus retrieving one, leaving the agent to guess based on tool names alone.

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/fmangot/Mcp'

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