Skip to main content
Glama
calebl
by calebl

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));

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