save_plan
Store implementation plans for software development projects to maintain organized documentation and track progress.
Instructions
Save the current implementation plan
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plan | Yes | The implementation plan text to save |
Implementation Reference
- src/index.ts:229-252 (handler)The handler function for the 'save_plan' tool. It checks for an active goal, parses the provided plan into todos using formatPlanAsTodos, adds each todo to storage, and returns a success message with the number of todos saved.case 'save_plan': { if (!this.currentGoal) { throw new McpError( ErrorCode.InvalidRequest, 'No active goal. Start a new planning session first.' ); } const { plan } = request.params.arguments as { plan: string }; const todos = formatPlanAsTodos(plan); for (const todo of todos) { await storage.addTodo(this.currentGoal.id, todo); } return { content: [ { type: 'text', text: `Successfully saved ${todos.length} todo items to the implementation plan.`, }, ], }; }
- src/index.ts:130-139 (schema)The input schema definition for the 'save_plan' tool, specifying a required 'plan' string parameter.inputSchema: { type: 'object', properties: { plan: { type: 'string', description: 'The implementation plan text to save', }, }, required: ['plan'], },
- src/index.ts:127-140 (registration)The registration of the 'save_plan' tool in the ListToolsRequestSchema handler, including name, description, and input schema.{ name: 'save_plan', description: 'Save the current implementation plan', inputSchema: { type: 'object', properties: { plan: { type: 'string', description: 'The implementation plan text to save', }, }, required: ['plan'], }, },
- src/prompts.ts:64-95 (helper)Helper function used in save_plan to parse the plan text into structured todo objects by splitting sections, extracting title, complexity, code examples, and description.export const formatPlanAsTodos = (plan: string): Array<{ title: string; description: string; complexity: number; codeExample?: string; }> => { // This is a placeholder implementation // In a real system, this would use more sophisticated parsing // to extract todos from the plan text const todos = plan.split('\n\n') .filter(section => section.trim().length > 0) .map(section => { const lines = section.split('\n'); const title = lines[0].replace(/^[0-9]+\.\s*/, '').trim(); const complexity = parseInt(section.match(/Complexity:\s*([0-9]+)/)?.[1] || '5'); const codeExample = section.match(/\`\`\`[^\`]*\`\`\`/)?.[0]; const description = section .replace(/^[0-9]+\.\s*[^\n]*\n/, '') .replace(/Complexity:\s*[0-9]+/, '') .replace(/\`\`\`[^\`]*\`\`\`/, '') .trim(); return { title, description, complexity, codeExample: codeExample?.replace(/^\`\`\`|\`\`\`$/g, ''), }; }); return todos; };
- src/storage.ts:71-95 (helper)Storage helper function called in the save_plan loop to add each parsed todo to the persistent plan storage for the current goal.async addTodo( goalId: string, { title, description, complexity, codeExample }: Omit<Todo, 'id' | 'isComplete' | 'createdAt' | 'updatedAt'> ): Promise<Todo> { const plan = await this.getPlan(goalId); if (!plan) { throw new Error(`No plan found for goal ${goalId}`); } const todo: Todo = { id: Date.now().toString(), title, description, complexity, codeExample, isComplete: false, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), }; plan.todos.push(todo); plan.updatedAt = new Date().toISOString(); await this.save(); return todo; }