Skip to main content
Glama

sequential_thinking

Break down complex coding problems into structured steps, validating each before proceeding to ensure systematic problem-solving and architectural decisions.

Instructions

A tool to facilitate sequential, structured thinking. It forces the AI to break down complex problems into steps, validating each before moving to the next. Use this when facing a complex coding task or architectural decision.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thoughtYesThe current thought or step in the reasoning process.
stepYesThe current step number (1-indexed).
total_stepsYesThe estimated total number of steps.
is_revisionNoSet to true if revising a previous step.
next_actionYesWhat to do next: continue thinking, revise previous thoughts, or provide the final answer.

Implementation Reference

  • Executes the sequential_thinking tool logic by echoing back structured thought data to reinforce step-by-step reasoning.
    export function sequentialThinkingHandler(args: any) {
        // In a real scenario, this might log to a file or maintain state across turns.
        // For now, it simply echoes back the structured thought to reinforce the behavior.
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify({
                        status: "THOUGHT_RECORDED",
                        step: args.step,
                        of: args.total_steps,
                        thought: args.thought,
                        next: args.next_action
                    }, null, 2)
                }
            ]
        };
    }
  • Defines the input schema using Zod for validating arguments to the sequential_thinking tool.
    export const sequentialThinkingSchema = {
        name: "sequential_thinking",
        description: "A tool to facilitate sequential, structured thinking. It forces the AI to break down complex problems into steps, validating each before moving to the next. Use this when facing a complex coding task or architectural decision.",
        inputSchema: z.object({
            thought: z.string().describe("The current thought or step in the reasoning process."),
            step: z.number().describe("The current step number (1-indexed)."),
            total_steps: z.number().describe("The estimated total number of steps."),
            is_revision: z.boolean().optional().describe("Set to true if revising a previous step."),
            next_action: z.enum(["CONTINUE", "REVISE", "The final conclusion or answer"]).describe("What to do next: continue thinking, revise previous thoughts, or provide the final answer.")
        })
    };
  • src/index.ts:78-78 (registration)
    Registers the sequential_thinking tool in the toolRegistry Map used by the stdio MCP server.
    ["sequential_thinking", { schema: sequentialThinkingSchema, handler: sequentialThinkingHandler }],
  • src/server.ts:88-88 (registration)
    Registers the sequential_thinking tool in the toolRegistry Map used by the HTTP MCP server.
    ["sequential_thinking", { schema: sequentialThinkingSchema, handler: sequentialThinkingHandler }],
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'validating each [step] before moving to the next,' which hints at a validation process, but doesn't disclose critical behavioral traits like whether this tool stores state, requires specific permissions, has rate limits, or what happens when steps are revised. For a tool with 5 parameters and no annotations, this is inadequate.

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

Conciseness5/5

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

The description is appropriately sized and front-loaded: two concise sentences that directly state the tool's purpose and usage. Every sentence earns its place with no wasted words or redundancy.

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 tool's complexity (5 parameters, no output schema, no annotations), the description is incomplete. It doesn't explain the expected output format, how validation works, whether this tool maintains state across steps, or how it interacts with sibling tools. For a structured thinking tool with significant parameter complexity, more context is needed.

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 already documents all 5 parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., it doesn't explain how 'thought' relates to 'step' or the validation process). Baseline 3 is appropriate when 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: 'facilitate sequential, structured thinking' and 'break down complex problems into steps.' It specifies the verb (facilitate/break down) and resource (thinking/problems), but doesn't explicitly differentiate from siblings like 'plan_task' or 'analyze_architecture' which might also involve structured thinking.

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

Usage Guidelines3/5

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

The description provides some usage guidance: 'Use this when facing a complex coding task or architectural decision.' This gives context but doesn't explicitly state when NOT to use it or mention alternatives among the many sibling tools. The guidance is implied rather than comprehensive.

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/millsydotdev/Code-MCP'

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