add_expense
Record a new expense by entering the date, amount, and category to track spending in the Expense Tracker MCP Server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | ||
| amount | Yes | ||
| category | Yes | ||
| subcategory | No | ||
| note | No |
Implementation Reference
- main.py:39-46 (handler)The 'add_expense' tool handler. Decorated with @mcp.tool() for registration and execution. Inserts expense into SQLite DB and returns ID.@mcp.tool() def add_expense(date, amount, category, subcategory="", note=""): with sqlite3.connect(DB_PATH) as c: cur = c.execute( "INSERT INTO expenses(date, amount, category, subcategory, note) VALUES (?, ?, ?, ?, ?)", (date, amount, category, subcategory, note) ) return {"status": "ok", "id": cur.lastrowid}