Skip to main content
Glama

revise_thought

Update and refine existing thoughts within structured thinking workflows to improve clarity, accuracy, and progression through problem-solving stages.

Instructions

Revises a thought in memory and in the thought history.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thoughtNoThe content of the current thought
thought_numberNoCurrent position in the sequence
total_thoughtsNoExpected total number of thoughts
next_thought_neededNoWhether another thought should follow
stageNoCurrent thinking stage (e.g., 'Problem Definition', 'Analysis')
is_revisionNoWhether this revises a previous thought
revises_thoughtNoNumber of thought being revised
branch_from_thoughtNoStarting point for a new thought branch
branch_idNoIdentifier for the current branch
needs_more_thoughtsNoWhether additional thoughts are needed
scoreNoQuality score (0.0 to 1.0)
tagsNoCategories or labels for the thought
thought_idYesThe ID of the thought to revise

Implementation Reference

  • Core handler function implementing the revise_thought tool: locates thought by ID, applies updates to specified fields, flags as revision, persists changes to history, and returns formatted response.
    reviseThought(input: { thought_id: number; thought?: string; thought_number?: number; total_thoughts?: number; next_thought_needed?: boolean; stage?: string; is_revision?: boolean; revises_thought?: number; branch_from_thought?: number; branch_id?: string; needs_more_thoughts?: boolean; score?: number; tags?: string[]; }): any { try { // Find the thought to revise const thought = this.findThoughtById(input.thought_id); if (!thought) { throw new Error(`Thought with ID ${input.thought_id} not found`); } // Update thought properties with any provided values if (input.thought !== undefined) thought.thought = input.thought; if (input.next_thought_needed !== undefined) thought.nextThoughtNeeded = input.next_thought_needed; if (input.stage !== undefined) thought.stage = thoughtStageFromString(input.stage); if (input.is_revision !== undefined) thought.isRevision = input.is_revision; if (input.revises_thought !== undefined) thought.revisesThought = input.revises_thought; if (input.branch_from_thought !== undefined) thought.branchFromThought = input.branch_from_thought; if (input.branch_id !== undefined) thought.branchId = input.branch_id; if (input.needs_more_thoughts !== undefined) thought.needsMoreThoughts = input.needs_more_thoughts; if (input.score !== undefined) thought.score = input.score; if (input.tags !== undefined) thought.tags = input.tags; // Set revision flag thought.isRevision = true; // Update thought in history this.updateThought(thought); return { content: [{ type: "text", text: JSON.stringify({ status: "success", revision: { thoughtNumber: thought.thoughtNumber, stage: thought.stage, updated: true, timestamp: DateTime.now().toISO() } }, null, 2) }] }; } catch (e) { return this.handleError(e); } }
  • Zod schema for revise_thought tool inputs, extending captureThoughtSchema with required thought_id and optional other fields.
    export const reviseThoughtSchema = captureThoughtSchema.extend({ thought_id: z.number().int().positive().describe("The ID of the thought to revise") }).partial().required({ thought_id: true });
  • src/tools.ts:52-57 (registration)
    MCP Tool object registration defining name, description, parameters schema, and input schema for revise_thought.
    export const reviseThoughtTool: Tool = { name: "revise_thought", description: "Revises a thought in memory and in the thought history.", parameters: reviseThoughtSchema, inputSchema: zodToInputSchema(reviseThoughtSchema) };
  • src/tools.ts:85-85 (registration)
    Inclusion of reviseThoughtTool in the exported toolDefinitions array used for listing available tools.
    reviseThoughtTool,
  • index.ts:99-118 (handler)
    Dispatch handler in MCP server that routes revise_thought calls to the SequentialThinkingServer.reviseThought method.
    case "revise_thought": { if (!params.arguments) { console.error("ERROR: params.arguments object is undefined in revise_thought request"); return { content: [{ type: "text", text: JSON.stringify({ error: "Invalid request: params.arguments object is undefined", status: "failed" }) }], isError: true }; } // Cast the arguments to match reviseThoughtSchema const reviseParams = params.arguments as z.infer<typeof reviseThoughtSchema>; return thinkingServer.reviseThought(reviseParams); }

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/Promptly-Technologies-LLC/mcp-structured-thinking'

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