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
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | active |
Implementation Reference
- src/coach_ai/storage.py:289-328 (handler)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() - src/coach_ai/server.py:564-571 (registration)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)