get_all_expenses
Retrieve a complete list of all recorded expenses from the Expense Tracker database to review spending history and track financial data.
Instructions
Get all expenses
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.py:70-76 (handler)This is the handler function for the 'get_all_expenses' tool. It is decorated with @mcp.tool, which registers it with the FastMCP server. The function initializes the database connection if necessary, executes a SQL query to select all expenses ordered by date descending, and returns them as a list of dictionaries.@mcp.tool async def get_all_expenses() -> List[Dict]: """Get all expenses""" await init_db() cursor = conn.cursor() cursor.execute('SELECT * FROM expenses ORDER BY date DESC') return [dict(row) for row in cursor.fetchall()]