list_expenses
Retrieve all recorded expenses between specified start and end dates to review spending patterns and track financial activity over time.
Instructions
list all expenses within an inclusive date range
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| start_date | Yes | ||
| end_date | Yes |
Implementation Reference
- main.py:48-60 (handler)The @mcp.tool() decorator registers the list_expenses function as an MCP tool. The handler queries the SQLite expenses table for records between start_date and end_date (inclusive), formats them as a list of dictionaries, and returns them.@mcp.tool() def list_expenses(start_date, end_date): """list all expenses within an inclusive date range""" with sqlite3.connect(DB_PATH) as c: cur = c.execute( """SELECT * from expenses where date between ? and ? order by id asc""", (start_date, end_date) ) cols = [d[0] for d in cur.description] return [dict(zip(cols, r)) for r in cur.fetchall()]