Skip to main content
Glama
Sudhanvaha

Expense Tracker MCP Server

by Sudhanvaha

delete

Remove expenses from the Expense Tracker MCP Server by specifying criteria such as ID, date, category, amount, or notes to maintain accurate financial records.

Instructions

Delete expenses based on any column criteria. like id,date,category,subcategory,amount,note,start_date,end_date

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo
dateNo
categoryNo
subcategoryNo
amountNo
noteNo
start_dateNo
end_dateNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:130-222 (handler)
    The `@mcp.tool()` decorated `delete` function implements the delete tool logic. It constructs a DELETE SQL query based on provided filter parameters (id, date, category, etc., or date range) and executes it on the expenses table, returning success/warning status with deleted count.
    @mcp.tool()
    def delete(
        id: Optional[int] = None,
        date: Optional[str] = None,
        category: Optional[str] = None,
        subcategory: Optional[str] = None,
        amount: Optional[float] = None,
        note: Optional[str] = None,
        start_date: Optional[str] = None,
        end_date: Optional[str] = None
    ) -> dict:
        """
        Delete expenses based on any column criteria.
        like id,date,category,subcategory,amount,note,start_date,end_date
        
        """
        with sqlite3.connect(DB_PATH) as c:
            conditions = []
            params = []
            
            # Handle date range separately
            if start_date is not None and end_date is not None:
                conditions.append("date BETWEEN ? AND ?")
                params.extend([start_date, end_date])
            elif start_date is not None or end_date is not None:
                return {
                    "status": "error",
                    "message": "Both start_date and end_date must be provided for date range"
                }
            
            # Handle individual column filters
            if id is not None:
                conditions.append("id = ?")
                params.append(id)
            
            if date is not None:
                conditions.append("date = ?")
                params.append(date)
            
            if category is not None:
                conditions.append("category = ?")
                params.append(category)
            
            if subcategory is not None:
                conditions.append("subcategory = ?")
                params.append(subcategory)
            
            if amount is not None:
                conditions.append("amount = ?")
                params.append(amount)
            
            if note is not None:
                conditions.append("note = ?")
                params.append(note)
            
            
            if not conditions:
                return {
                    "status": "error",
                    "message": "At least one filter parameter must be provided"
                }
            
            
            query = "DELETE FROM expenses WHERE " + " AND ".join(conditions)
            
            cur = c.execute(query, params)
            c.commit()
            
            deleted_count = cur.rowcount
            
            if deleted_count > 0:
                return {
                    "status": "success",
                    "message": f"Successfully deleted {deleted_count} expense(s)",
                    "deleted_count": deleted_count,
                    "criteria": {k: v for k, v in {
                        "id": id,
                        "date": date,
                        "category": category,
                        "subcategory": subcategory,
                        "amount": amount,
                        "note": note,
                        "start_date": start_date,
                        "end_date": end_date
                    }.items() if v is not None}
                }
            else:
                return {
                    "status": "warning",
                    "message": "No expenses found matching the criteria",
                    "deleted_count": 0
                }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states this is a deletion operation but doesn't disclose critical behavioral traits: whether deletions are permanent or reversible, if there are confirmation prompts, what permissions are required, or what happens when multiple criteria match multiple records. The description is insufficient for a destructive operation with zero annotation coverage.

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

Conciseness3/5

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

Two sentences with no wasted words, but the second sentence is poorly formatted ('like' instead of 'e.g.' or 'such as') and reads as a continuation rather than proper structure. The information is front-loaded but could be more professionally presented.

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

Completeness2/5

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

This is a destructive mutation tool with 8 parameters, 0% schema description coverage, no annotations, but has an output schema. The description fails to address critical context: deletion permanence, criteria logic, error conditions, or relationship to sibling tools. For a tool with this complexity and risk profile, the description is inadequate.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It lists parameter names but doesn't explain their semantics: what format dates should use, whether 'amount' is exact match or range, how criteria combine (AND/OR), or what happens when no criteria are specified. The list adds minimal value beyond the schema's property names.

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

Purpose3/5

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

The description states 'Delete expenses based on any column criteria' which provides a clear verb ('Delete') and resource ('expenses'), but it doesn't differentiate from sibling tools like 'update' which also modifies expenses. The purpose is understandable but lacks sibling differentiation.

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?

No guidance is provided about when to use this tool versus alternatives like 'update' or 'list_expenses'. The description mentions column criteria but doesn't explain prerequisites, constraints, or when this deletion is appropriate 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