Skip to main content
Glama
Sudhanvaha

Expense Tracker MCP Server

by Sudhanvaha

update

Modify existing expense records by updating specific fields like amount, date, category, or notes while keeping other information unchanged.

Instructions

Update an expense.Only provided fields will be updated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYes
dateNo
amountNo
categoryNo
subcategoryNo
noteNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:81-129 (handler)
    The @mcp.tool() decorated 'update' function implements the MCP tool named 'update'. It conditionally updates fields (date, amount, category, subcategory, note) for an expense by ID in the SQLite database and returns the updated record or error.
    @mcp.tool()
    def update(
        cid: int,
        date: Optional[str] = None,
        amount: Optional[float] = None,
        category: Optional[str] = None,
        subcategory: Optional[str] = None,
        note: Optional[str] = None
    ) -> list[dict]:
    
        """Update an expense.Only provided fields will be updated."""
        with sqlite3.connect(DB_PATH) as c:
            update_fields=[]
            params=[]
    
            if date is not None:
                update_fields.append("date=?")
                params.append(date)
            if amount is not None:
                update_fields.append("amount=?")
                params.append(amount)
            if category is not None:
                update_fields.append("category=?")
                params.append(category)
            if subcategory is not None:
                update_fields.append("subcategory=?")
                params.append(subcategory)
            if note is not None:
                update_fields.append("note=?")
                params.append(note)
            
            if not update_fields:
                return {"No fields provided to update"}
            
            params.append(cid)
    
            query=f"UPDATE expenses SET {', '.join(update_fields)} WHERE id=?"
            c.execute(query,params)
            c.commit()
    
            select_query="select * from expenses where id=?"
            cur=c.execute(select_query,[cid])
            cols = [d[0] for d in cur.description]
            rows = cur.fetchall()
            
            if rows:
                return [dict(zip(cols, r)) for r in rows]
            else:
                return {"error": f"No expense found with id {cid}"}
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. While it mentions 'Only provided fields will be updated' (partial update behavior), it doesn't address important aspects like required permissions, whether updates are reversible, error conditions, or what happens when invalid data is provided. For a mutation tool with zero annotation coverage, this is insufficient.

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 extremely concise - just two sentences that communicate the core functionality and a key behavioral aspect. Every word earns its place with zero redundancy or unnecessary elaboration.

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

Completeness3/5

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

Given this is a mutation tool with no annotations, 6 parameters (only 1 documented via description), but with an output schema present, the description is minimally adequate. The presence of an output schema means return values are documented elsewhere, but the description should do more to explain the mutation's behavior and parameter meanings.

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

Parameters3/5

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

The description adds some value by explaining the partial update behavior ('Only provided fields will be updated'), which helps interpret the null-able parameters in the schema. However, with 0% schema description coverage and 6 parameters, it doesn't explain what 'cid', 'date', 'amount', 'category', 'subcategory', or 'note' represent or their expected formats.

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 action ('Update') and resource ('an expense'), making the purpose immediately understandable. However, it doesn't differentiate from the 'delete' sibling tool or explain what distinguishes this update operation from other potential expense modifications.

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 like 'add_expense' or 'delete'. There's no mention of prerequisites, constraints, or appropriate contexts for expense updates versus other operations.

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/Sudhanvaha/expense-tracker-mcp-server'

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