list_todos
View tasks filtered by completion status to manage your to-do list effectively. Use this tool to see active, completed, or all tasks for better productivity organization.
Instructions
List todos filtered by status.
Args: status: Filter by 'active', 'completed', or 'all' (default: 'active')
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | active |
Implementation Reference
- src/coach_ai/storage.py:164-208 (handler)The actual implementation of the list_todos functionality, which queries the database and formats the results.
async def list_todos(status: str = "active") -> str: """List todos filtered by status. Args: status: Filter by 'active', 'completed', or 'all' Returns: Formatted list of todos """ db = await get_db() if status == "all": cursor = await db.execute( "SELECT * FROM todos ORDER BY priority DESC, created_at DESC" ) else: cursor = await db.execute( "SELECT * FROM todos WHERE status = ? ORDER BY priority DESC, created_at DESC", (status,), ) rows = await cursor.fetchall() if not rows: return f"No {status} todos found." # Format output result = f"\n=== {status.upper()} TODOS ===\n\n" # Group by priority priority_groups = {"high": [], "medium": [], "low": []} for row in rows: priority_groups[row["priority"]].append(row) for priority in ["high", "medium", "low"]: todos = priority_groups[priority] if todos: result += f"{priority.upper()} PRIORITY:\n" for todo in todos: result += f" [{todo['id']}] {todo['title']}\n" if todo["notes"]: result += f" Notes: {todo['notes']}\n" result += "\n" return result.strip() - src/coach_ai/server.py:136-143 (registration)The MCP tool registration for list_todos, which calls the storage implementation.
@mcp.tool() async def list_todos(status: str = "active") -> str: """List todos filtered by status. Args: status: Filter by 'active', 'completed', or 'all' (default: 'active') """ return await storage.list_todos(status)