Skip to main content
Glama
PK-SANGAMESWAR

Expense Tracker MCP Server

delete_expense

Remove an expense entry from the Expense Tracker database by specifying its unique identifier to maintain accurate financial records.

Instructions

Delete an expense from the database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • main.py:135-146 (handler)
    The handler function 'delete_expense' is registered as an MCP tool and performs a SQL DELETE operation on the expenses table.
    @mcp.tool()
    def delete_expense(id):
        """Delete an expense from the database."""
        try:
            with sqlite3.connect(DB_PATH) as conn:
                cursor = conn.cursor()
                cursor.execute("DELETE FROM expenses WHERE id = ?", (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