Skip to main content
Glama
xinrong-meng

My Finance MCP Server

delete_transactions

Remove specific or all financial transactions from both JSON ledger and ChromaDB storage. Requires confirmation for safety when deleting transaction data.

Instructions

Delete transactions from both the JSON ledger and ChromaDB.

Args:
    indices: List of transaction indices (from list_transactions) to delete
    delete_all: Set to true to delete all transactions
    confirm: Must be true to actually perform deletion (safety guard)

Returns:
    Status message describing the deletion result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indicesNo
delete_allNo
confirmNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'delete_transactions' tool, which deletes transactions from the JSON ledger and ChromaDB based on indices or all if specified. Includes safety confirm parameter. The @mcp.tool() decorator registers it.
    @mcp.tool()
    def delete_transactions(indices: Optional[List[int]] = None, delete_all: bool = False, confirm: bool = False) -> str:
        """
        Delete transactions from both the JSON ledger and ChromaDB.
    
        Args:
            indices: List of transaction indices (from list_transactions) to delete
            delete_all: Set to true to delete all transactions
            confirm: Must be true to actually perform deletion (safety guard)
    
        Returns:
            Status message describing the deletion result
        """
        if not confirm:
            raise ValueError("Deletion aborted: set confirm=True to proceed.")
    
        transactions = _load_transactions()
    
        if delete_all:
            deleted_count = len(transactions)
            _save_transactions([])
            try:
                # Recreate the collection to ensure it is empty
                global collection
                chroma_client.delete_collection("transactions")
                collection = chroma_client.get_or_create_collection("transactions")
            except chromadb.errors.InvalidCollectionException:
                pass
            return f"Deleted {deleted_count} transactions." if deleted_count else "No transactions to delete."
    
        if not indices:
            raise ValueError("Provide indices to delete or set delete_all=True.")
    
        indices_set = set(indices)
        remaining: List[Dict[str, Any]] = []
        removed: List[Dict[str, Any]] = []
    
        for idx, txn in enumerate(transactions):
            if idx in indices_set:
                removed.append(txn)
            else:
                remaining.append(txn)
    
        if not removed:
            return "No transactions matched the provided indices."
    
        _save_transactions(remaining)
    
        # Remove matching entries from ChromaDB using metadata filters
        for txn in removed:
            metadata_filter = {k: v for k, v in txn.items() if isinstance(k, str)}
            try:
                collection.delete(where=metadata_filter)
            except Exception:
                # If metadata-based delete fails, ignore but keep JSON consistent
                continue
    
        return f"Deleted {len(removed)} transactions."
  • The @mcp.tool() decorator registers the delete_transactions function as an MCP tool.
    @mcp.tool()
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: it's a destructive operation (deleting from two data stores), includes a safety guard (confirm parameter), and describes the return value. However, it doesn't mention potential side effects like data irreversibility or error conditions, leaving some gaps.

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 appropriately sized and front-loaded: the first sentence states the purpose clearly, followed by a structured Args and Returns section. Every sentence earns its place by providing critical information without redundancy, making it efficient and easy to parse.

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 complexity (destructive operation with 3 parameters), no annotations, and an output schema (which handles return values), the description is mostly complete. It covers purpose, parameters, and safety, but could improve by mentioning prerequisites (e.g., needing list_transactions first) or error cases, slightly reducing completeness.

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

Parameters5/5

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

The schema description coverage is 0%, so the description must compensate fully. It does so by clearly explaining all three parameters: indices (list from list_transactions), delete_all (set to true for all), and confirm (safety guard). This adds essential meaning beyond the bare schema, making the parameters understandable and actionable.

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

Purpose5/5

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

The description clearly states the specific action ('Delete transactions') and resources ('from both the JSON ledger and ChromaDB'), distinguishing it from sibling tools like list_transactions (read-only) and store_transactions (create/update). It precisely defines what the tool does beyond just restating the name.

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

Usage Guidelines3/5

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

The description implies usage by referencing list_transactions for indices, but does not explicitly state when to use this tool versus alternatives like query_financial_history or store_transactions. It provides some context (e.g., using indices from list_transactions) but lacks clear exclusions or comparative guidance with other tools.

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/xinrong-meng/my-finance-mcp'

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