import { z } from "zod";
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.")
})
};
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)
}
]
};
}