complete_todo
Mark tasks as completed in Coach AI's task management system by specifying the todo ID to track progress and maintain productivity.
Instructions
Mark a todo as complete.
Args: todo_id: The ID of the todo to complete
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| todo_id | Yes |
Implementation Reference
- src/coach_ai/storage.py:211-236 (handler)The core logic that updates the todo status to 'completed' in the database.
async def complete_todo(todo_id: int) -> str: """Mark a todo as complete. Args: todo_id: The ID of the todo to complete Returns: Success message or error """ db = await get_db() # Get todo title for confirmation cursor = await db.execute("SELECT title FROM todos WHERE id = ?", (todo_id,)) row = await cursor.fetchone() if not row: return f"Error: Todo #{todo_id} not found." # Mark as complete await db.execute( "UPDATE todos SET status = 'completed', completed_at = CURRENT_TIMESTAMP WHERE id = ?", (todo_id,), ) await db.commit() return f"✓ Completed: {row['title']}" - src/coach_ai/server.py:146-153 (registration)The MCP tool registration using @mcp.tool() and the wrapper function that calls the storage handler.
@mcp.tool() async def complete_todo(todo_id: int) -> str: """Mark a todo as complete. Args: todo_id: The ID of the todo to complete """ return await storage.complete_todo(todo_id)