Skip to main content
Glama
calebl

YNAB MCP Server

by calebl

Delete Transaction

ynab_delete_transaction

Permanently delete a transaction from your YNAB budget. Irreversible action that removes the transaction immediately.

Instructions

Deletes a transaction from the budget. This action cannot be undone.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budgetIdNoThe ID of the budget (optional, defaults to YNAB_BUDGET_ID environment variable)
transactionIdYesThe ID of the transaction to delete

Implementation Reference

  • The execute function that deletes a transaction via the YNAB API. Calls api.transactions.deleteTransaction and returns a success/error result.
    export async function execute(input: DeleteTransactionInput, api: ynab.API) {
      try {
        const budgetId = getBudgetId(input.budgetId);
    
        const response = await api.transactions.deleteTransaction(
          budgetId,
          input.transactionId
        );
    
        if (!response.data.transaction) {
          throw new Error("Failed to delete transaction - no transaction data returned");
        }
    
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify({
              success: true,
              transactionId: response.data.transaction.id,
              message: "Transaction deleted successfully",
            }, null, 2),
          }],
        };
      } catch (error) {
        console.error("Error deleting transaction:", error);
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify({
              success: false,
              error: getErrorMessage(error),
            }, null, 2),
          }],
        };
      }
    }
  • Input schema defining budgetId (optional string) and transactionId (required string) using Zod.
    export const inputSchema = {
      budgetId: z.string().optional().describe("The ID of the budget (optional, defaults to YNAB_BUDGET_ID environment variable)"),
      transactionId: z.string().describe("The ID of the transaction to delete"),
    };
  • src/index.ts:93-97 (registration)
    Registration of the tool on the server using server.registerTool with name, title, description, inputSchema, and execute handler.
    server.registerTool(DeleteTransactionTool.name, {
      title: "Delete Transaction",
      description: DeleteTransactionTool.description,
      inputSchema: DeleteTransactionTool.inputSchema,
    }, async (input) => DeleteTransactionTool.execute(input, api));
  • src/index.ts:17-17 (registration)
    Import of DeleteTransactionTool module in the main index.ts file.
    import * as DeleteTransactionTool from "./tools/DeleteTransactionTool.js";
  • Helper function getBudgetId that resolves budget ID from input or env var, throwing if not found.
    function getBudgetId(inputBudgetId?: string): string {
      const budgetId = inputBudgetId || process.env.YNAB_BUDGET_ID || "";
      if (!budgetId) {
        throw new Error("No budget ID provided. Please provide a budget ID or set the YNAB_BUDGET_ID environment variable.");
      }
      return budgetId;
    }
Behavior3/5

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

The description notes that the action cannot be undone, which is a critical behavioral trait. However, with no annotations present, it fails to disclose other potential behaviors such as permissions required, effects on related entities, or error conditions like attempting to delete a deleted transaction.

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 with two sentences: the first states the primary action, and the second adds a critical warning. Every word earns its place, and key information is front-loaded.

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 simplicity of the tool (delete a transaction) and the lack of an output schema, the description covers the core action and an important behavioral warning. However, it could be more complete by indicating what the response looks like (e.g., success confirmation) or any constraints on the transaction status.

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 input schema already provides full parameter descriptions (100% coverage). The description adds no additional meaning beyond the schema, so the baseline score of 3 is appropriate.

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 action (delete) and the resource (transaction). It distinguishes this tool from siblings like ynab_create_transaction or ynab_update_transaction by specifying deletion, making it easy for an agent to select the correct tool.

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 does not provide any guidance on when to use this tool versus alternatives or any prerequisites. For example, it doesn't explain that transactions might need to be unapproved before deletion, nor does it mention appropriate context for deletion.

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/calebl/ynab-mcp-server'

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