Skip to main content
Glama

delete_txn

Delete a specific transaction by its ID to recalculate subsequent positions and average cost. Requires explicit user confirmation.

Instructions

Delete a single transaction by its id. The user must confirm — never call this without explicit instruction (e.g. "delete transaction #42"). Removing a transaction recalculates all subsequent positions/avg cost since holdings are derived from the log.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • The actual MCP tool handler for 'delete_txn'. It registers a server.tool with Zod schema (id: z.number().int().positive()), deletes from the transactions table using Drizzle ORM, and returns the deleted id or an error if not found.
    server.tool(
      'delete_txn',
      'Delete a single transaction by its id. The user must confirm — never call this without explicit instruction (e.g. "delete transaction #42"). Removing a transaction recalculates all subsequent positions/avg cost since holdings are derived from the log.',
      { id: z.number().int().positive() },
      async ({ id }) => {
        const db = getDb();
        const res = db.delete(transactions).where(eq(transactions.id, id)).run();
        if (res.changes === 0) return err(`Transaction #${id} not found`);
        return ok({ deleted: id });
      },
    );
  • The tool is registered via server.tool('delete_txn', ...) in the registerMutateTools function within mutate.ts.
    server.tool(
      'delete_txn',
      'Delete a single transaction by its id. The user must confirm — never call this without explicit instruction (e.g. "delete transaction #42"). Removing a transaction recalculates all subsequent positions/avg cost since holdings are derived from the log.',
      { id: z.number().int().positive() },
      async ({ id }) => {
        const db = getDb();
        const res = db.delete(transactions).where(eq(transactions.id, id)).run();
        if (res.changes === 0) return err(`Transaction #${id} not found`);
        return ok({ deleted: id });
      },
    );
  • The input schema for delete_txn: a single required parameter 'id' of type z.number().int().positive().
    'Delete a single transaction by its id. The user must confirm — never call this without explicit instruction (e.g. "delete transaction #42"). Removing a transaction recalculates all subsequent positions/avg cost since holdings are derived from the log.',
    { id: z.number().int().positive() },
Behavior5/5

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

Discloses that removing a transaction recalculates subsequent positions/avg cost, which is critical behavioral information. With no annotations, the description fully covers the safety and side effects.

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?

Two sentences, front-loaded with the core purpose, then behavioral and usage details. Every sentence adds value with no redundancy.

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

Completeness5/5

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

Given the simple input schema (single integer id) and no output schema, the description provides all necessary context: what it does, how to use it, and what side effects occur. It is fully adequate for safe invocation.

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?

Schema description coverage is 0%, but the description only adds 'by its id', which is minimal. It does not elaborate on the id parameter's meaning or format beyond the schema, so it only partially compensates.

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 'Delete a single transaction by its id', specifying the exact verb and resource. It distinguishes from sibling delete tools like delete_balance by focusing exclusively on transactions.

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

Usage Guidelines5/5

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

Provides explicit guidance: 'The user must confirm — never call this without explicit instruction' and gives an example. This clearly tells the agent when and how to invoke the tool.

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/evan-moon/firma'

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