Skip to main content
Glama
PK-SANGAMESWAR

Expense Tracker MCP Server

edit_expense

Update existing expense records in the Expense Tracker database to correct errors, modify categories, adjust amounts, or add notes.

Instructions

Edit an existing expense in the database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
dateYes
amountYes
categoryYes
subcategoryNo
noteNo

Implementation Reference

  • main.py:116-131 (handler)
    The edit_expense tool is defined and registered using the @mcp.tool() decorator, and contains the logic to update an existing expense entry in the SQLite database.
    @mcp.tool()
    def edit_expense(id, date, amount, category, subcategory="", note=""):
        """Edit an existing expense in the database."""
        try:
            with sqlite3.connect(DB_PATH) as conn:
                cursor = conn.cursor()
                cursor.execute("""
                UPDATE expenses
                SET date = ?, amount = ?, category = ?, subcategory = ?, note = ?
                WHERE id = ?
                """, (date, float(amount), category, subcategory, note, id))
                if cursor.rowcount == 0:
                    return {"status": "error", "error": "No expense with that id"}
                return {"status": "ok"}
        except Exception as e:
            return {"status": "error", "error": str(e)}

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/PK-SANGAMESWAR/mcp-expense-tracker'

If you have feedback or need assistance with the MCP directory API, please join our Discord server