todo_restore
Restore todo snapshots from previous sessions to continue work where you left off, using active or specific saved versions.
Instructions
Get todo snapshot for restoring (active snapshot or specific ID)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| snapshot_id | No | Specific snapshot ID (optional, defaults to active snapshot) | |
| project_path | No | Project path (used if snapshot_id not provided) |
Input Schema (JSON Schema)
{
"properties": {
"project_path": {
"description": "Project path (used if snapshot_id not provided)",
"type": "string"
},
"snapshot_id": {
"description": "Specific snapshot ID (optional, defaults to active snapshot)",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/mcp_server/server.py:509-519 (handler)Core handler logic for the todo_restore tool. Retrieves the todo snapshot (by ID or active for project) from storage and formats it using _format_todo_snapshot_detail.if name == "todo_restore": snapshot_id = arguments.get("snapshot_id") project_path = arguments.get("project_path", os.getcwd()) snapshot = self.storage.get_todo_snapshot(snapshot_id) if snapshot_id else self.storage.get_active_todo_snapshot(project_path) if not snapshot: return [TextContent(type="text", text="No todo snapshot found")] result = self._format_todo_snapshot_detail(snapshot) return [TextContent(type="text", text=result)]
- src/mcp_server/server.py:285-301 (registration)Registration of the todo_restore tool in list_tools(), including its schema and description.Tool( name="todo_restore", description="Get todo snapshot for restoring (active snapshot or specific ID)", inputSchema={ "type": "object", "properties": { "snapshot_id": { "type": "string", "description": "Specific snapshot ID (optional, defaults to active snapshot)", }, "project_path": { "type": "string", "description": "Project path (used if snapshot_id not provided)", }, }, }, ),
- src/mcp_server/server.py:711-737 (helper)Supporting helper function to format todo snapshot details for the response.def _format_todo_snapshot_detail(self, snapshot: Any) -> str: """Format a single todo snapshot with full details.""" from models import TodoListSnapshot if not isinstance(snapshot, TodoListSnapshot): return "Invalid snapshot" lines = [ f"Snapshot ID: {snapshot.id}", f"Timestamp: {snapshot.timestamp.isoformat()}", f"Project: {snapshot.project_path}", f"Active: {'Yes' if snapshot.is_active else 'No'}", ] if snapshot.context: lines.append(f"Context: {snapshot.context}") if snapshot.session_context_id: lines.append(f"Linked Context ID: {snapshot.session_context_id}") lines.append("\n## Todo Items\n") for i, todo in enumerate(snapshot.todos, 1): status_icon = {"pending": "○", "in_progress": "⟳", "completed": "✓"}.get(todo.status, "○") lines.append(f"{i}. {status_icon} [{todo.status}] {todo.content}") return "\n".join(lines)