Skip to main content
Glama
calebl

YNAB MCP Server

by calebl

Delete Transaction

ynab_delete_transaction

Remove a transaction from your YNAB budget. This action permanently deletes the specified transaction and cannot be reversed.

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 main handler function that executes the deletion of a YNAB transaction using the API. Handles budget ID resolution, API call, success/error responses.
    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),
          }],
        };
      }
    }
  • Exports the tool name, description, and Zod input schema defining budgetId (optional) and transactionId parameters.
    export const name = "ynab_delete_transaction";
    export const description = "Deletes a transaction from the budget. This action cannot be undone.";
    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)
    Registers the tool with the MCP server using name, custom title, description, inputSchema from the tool module, and async executor calling the tool's execute function with API.
    server.registerTool(DeleteTransactionTool.name, {
      title: "Delete Transaction",
      description: DeleteTransactionTool.description,
      inputSchema: DeleteTransactionTool.inputSchema,
    }, async (input) => DeleteTransactionTool.execute(input, api));
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 of behavioral disclosure. It effectively communicates the destructive and irreversible nature of the action ('This action cannot be undone'), which is critical for a deletion tool. However, it lacks details on permissions, error handling, or response behavior, 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 front-loaded with the core action and resource, followed by a critical warning. Both sentences earn their place by providing essential information without redundancy, making it highly efficient and well-structured.

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?

For a destructive tool with no annotations and no output schema, the description adequately covers the irreversible nature but lacks completeness. It doesn't address potential side effects, error conditions, or what happens upon success, leaving the agent with incomplete contextual understanding.

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 100%, so the schema fully documents both parameters (budgetId and transactionId). The description adds no additional parameter semantics beyond what the schema provides, such as format examples or contextual usage, resulting in a baseline score of 3.

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 ('Deletes') and resource ('a transaction from the budget'), distinguishing it from sibling tools like ynab_create_transaction or ynab_update_transaction. It precisely communicates the destructive nature of the operation.

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 for deletion scenarios but provides no explicit guidance on when to use this tool versus alternatives like ynab_update_transaction for modifications or ynab_get_transactions for viewing. It mentions the irreversible nature, which hints at caution, but lacks sibling differentiation or prerequisites.

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