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
| Name | Required | Description | Default |
|---|---|---|---|
| thought | Yes | The current thought or step in the reasoning process. | |
| step | Yes | The current step number (1-indexed). | |
| total_steps | Yes | The estimated total number of steps. | |
| is_revision | No | Set to true if revising a previous step. | |
| next_action | Yes | What to do next: continue thinking, revise previous thoughts, or provide the final answer. |
Implementation Reference
- src/tools/thinking.ts:15-32 (handler)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) } ] }; }
- src/tools/thinking.ts:3-13 (schema)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 }],