Skip to main content
Glama
Omkar4141

Expense Tracker MCP Server

by Omkar4141

add_expense

Record a new expense by specifying amount and category, with optional description, to track spending in the Expense Tracker MCP Server.

Instructions

Add a new expense

Args: amount: Expense amount category: Expense category (e.g., 'food', 'transport', 'utilities') description: Optional description

Returns: ID of the added expense

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYes
categoryYes
descriptionNo

Implementation Reference

  • main.py:36-58 (handler)
    The main handler function for the 'add_expense' tool. It is decorated with @mcp.tool for registration and includes input schema via type annotations and docstring. Inserts a new expense record into the SQLite database and returns the ID.
    @mcp.tool async def add_expense(amount: float, category: str, description: str = "") -> int: """ Add a new expense Args: amount: Expense amount category: Expense category (e.g., 'food', 'transport', 'utilities') description: Optional description Returns: ID of the added expense """ await init_db() date = datetime.now().strftime('%Y-%m-%d %H:%M:%S') cursor = conn.cursor() cursor.execute(''' INSERT INTO expenses (amount, category, description, date) VALUES (?, ?, ?, ?) ''', (amount, category, description, date)) conn.commit() return cursor.lastrowid
Install Server

Other Tools

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/Omkar4141/dbserver_mcp'

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