get_total
Calculate the total sum of all recorded expenses in the Expense Tracker MCP Server to monitor spending and manage budgets.
Instructions
Get total of all expenses
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.py:60-67 (handler)Handler function for the get_total tool. It initializes the database connection if needed, executes a SQL query to sum all expense amounts, and returns the total as a float.@mcp.tool async def get_total() -> float: """Get total of all expenses""" await init_db() cursor = conn.cursor() cursor.execute('SELECT SUM(amount) as total FROM expenses') result = cursor.fetchone() return result['total'] or 0.0