Skip to main content
Glama
PK-SANGAMESWAR

Expense Tracker MCP Server

add_credit

Increase available funds in your Expense Tracker account to manage spending and maintain accurate financial records.

Instructions

Add credit to the user's account. By default updates 'default' user. Returns new credit amount.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYes
user_nameNodefault

Implementation Reference

  • main.py:150-166 (handler)
    The add_credit function is decorated with @mcp.tool() and handles adding credit to a user's account in the database.
    @mcp.tool()
    def add_credit(amount, user_name="default"):
        """
        Add credit to the user's account. By default updates 'default' user.
        Returns new credit amount.
        """
        try:
            with sqlite3.connect(DB_PATH) as conn:
                cursor = conn.cursor()
                # ensure user exists
                cursor.execute("INSERT OR IGNORE INTO users (name, credit) VALUES (?, ?)", (user_name, 0.0))
                cursor.execute("UPDATE users SET credit = credit + ? WHERE name = ?", (float(amount), user_name))
                cursor.execute("SELECT credit FROM users WHERE name = ?", (user_name,))
                new_credit = cursor.fetchone()[0]
                return {"status": "ok", "credit": new_credit}
        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