Skip to main content
Glama

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
NameRequiredDescriptionDefault
statusNoactive

Implementation Reference

  • 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()
  • 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/94aharris/coach-ai'

If you have feedback or need assistance with the MCP directory API, please join our Discord server