list_todos
Retrieve and filter todo items by status to track pending, completed, or all tasks within the MCP Reminder system.
Instructions
列出待办事项
Args: status: 筛选状态,可选值: "pending"(未完成)、"completed"(已完成)、"all"(全部),默认"pending"
Returns: 待办事项列表
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | pending |
Implementation Reference
- src/mcp_reminder/server.py:278-317 (handler)The `list_todos` function, registered as an MCP tool, retrieves and filters tasks based on their status ("pending", "completed", or "all") and returns them as a structured list.
def list_todos(status: str = "pending") -> dict: """ 列出待办事项 Args: status: 筛选状态,可选值: "pending"(未完成)、"completed"(已完成)、"all"(全部),默认"pending" Returns: 待办事项列表 """ todos = storage.load_todos() # 筛选 if status == "pending": todos = [t for t in todos if t.status == "pending"] elif status == "completed": todos = [t for t in todos if t.status == "completed"] # status == "all" 则不筛选 logger.info(f"列出待办事项,状态: {status}, 数量: {len(todos)}") todos_data = [ { "id": todo.id, "title": todo.title, "description": todo.description, "remind_time": todo.remind_time, "status": todo.status, "created_at": todo.created_at } for todo in todos ] return { "success": True, "count": len(todos), "todos": todos_data, "status_filter": status }