Skip to main content
Glama

list_goals

Retrieve and filter goals from Coach AI's task management system to track progress and maintain focus on objectives.

Instructions

List all goals.

Args: status: Filter by 'active' or 'all' (default: 'active')

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNoactive

Implementation Reference

  • The actual implementation of the 'list_goals' function which queries the database and formats the list of goals.
    async def list_goals(status: str = "active") -> str:
        """List all goals.
    
        Args:
            status: Filter by 'active' or 'all'
    
        Returns:
            Formatted list of goals
        """
        db = await get_db()
    
        if status == "all":
            cursor = await db.execute("SELECT * FROM goals ORDER BY created_at DESC")
        else:
            cursor = await db.execute(
                "SELECT * FROM goals WHERE status = ? ORDER BY created_at DESC", (status,)
            )
    
        rows = await cursor.fetchall()
    
        if not rows:
            return f"No {status} goals found."
    
        result = f"\n=== {status.upper()} GOALS ===\n\n"
    
        # Group by timeframe
        timeframes = {}
        for row in rows:
            tf = row["timeframe"]
            if tf not in timeframes:
                timeframes[tf] = []
            timeframes[tf].append(row)
    
        for timeframe, goals in timeframes.items():
            result += f"{timeframe.upper()}:\n"
            for goal in goals:
                result += f"  [{goal['id']}] {goal['goal']} ({goal['category']})\n"
            result += "\n"
    
        return result.strip()
  • The MCP tool registration for 'list_goals' in server.py, which delegates the call to storage.list_goals.
    @mcp.tool()
    async def list_goals(status: str = "active") -> str:
        """List all goals.
    
        Args:
            status: Filter by 'active' or 'all' (default: 'active')
        """
        return await storage.list_goals(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