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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a creation operation ('Add a new expense'), implying mutation, but doesn't address permissions, error conditions, validation rules, or side effects. The return value is mentioned but without details on format or potential failures. More behavioral context is needed for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized. It front-loads the core purpose ('Add a new expense') followed by clear sections for Args and Returns. Every sentence earns its place by providing essential information without redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, mutation operation) and the presence of an output schema (implied by 'Returns: ID of the added expense'), the description is reasonably complete. It covers purpose, parameters, and return value. However, with no annotations and a mutation tool, it could benefit from more behavioral details like error handling or permissions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant semantic value beyond the input schema, which has 0% description coverage. It clarifies that 'amount' is the 'Expense amount', 'category' includes examples like 'food', 'transport', 'utilities', and 'description' is optional with a default. This compensates well for the schema's lack of descriptions, though it doesn't cover validation rules or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Add') and resource ('expense'), making it immediately understandable. It distinguishes from sibling tools like 'get_all_expenses' and 'get_total' by focusing on creation rather than retrieval or aggregation. However, it doesn't explicitly contrast with siblings in the description text itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_all_expenses' or 'get_total', nor does it specify prerequisites, constraints, or appropriate contexts for expense creation. The user must infer usage from the purpose alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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