Skip to main content
Glama
justmytwospence

ynab-mcp

update_transaction

Modify existing YNAB transaction details like amount, date, payee, category, or status to correct errors or reflect changes in your budget.

Instructions

[1 API call] Update an existing transaction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idNoBudget ID or 'last-used'last-used
transaction_idYesThe transaction ID to update
account_idNoNew account ID
dateNoNew date (YYYY-MM-DD)
amountNoNew amount in dollars
payee_idNoNew payee ID
payee_nameNoNew payee name
category_idNoNew category ID
memoNoNew memo
clearedNoNew cleared status
approvedNoNew approval status
flag_colorNoNew flag color

Implementation Reference

  • Registration and implementation of the 'update_transaction' MCP tool.
    server.registerTool("update_transaction", {
      title: "Update Transaction",
      description: "[1 API call] Update an existing transaction",
      inputSchema: {
        budget_id: z.string().default("last-used").describe("Budget ID or 'last-used'"),
        transaction_id: z.string().describe("The transaction ID to update"),
        account_id: z.string().optional().describe("New account ID"),
        date: z.string().optional().describe("New date (YYYY-MM-DD)"),
        amount: z.number().optional().describe("New amount in dollars"),
        payee_id: z.string().optional().describe("New payee ID"),
        payee_name: z.string().optional().describe("New payee name"),
        category_id: z.string().optional().describe("New category ID"),
        memo: z.string().optional().describe("New memo"),
        cleared: z.enum(CLEARED_VALUES).optional().describe("New cleared status"),
        approved: z.boolean().optional().describe("New approval status"),
        flag_color: z.enum(FLAG_COLORS).optional().describe("New flag color"),
      },
      annotations: { readOnlyHint: false },
    }, async ({ budget_id, transaction_id, ...fields }) => {
      try {
        const data: any = { ...fields };
        if (data.amount != null) data.amount = dollarsToMilliunits(data.amount);
        if (data.flag_color !== undefined) data.flag_color = data.flag_color ?? null;
        const response = await getClient().transactions.updateTransaction(budget_id, transaction_id, {
          transaction: data,
        });
        const t = response.data.transaction;
        return textResult(
          `Updated transaction: ${t.date} | ${formatCurrency(t.amount)} | ${t.payee_name ?? "No payee"}\nID: ${t.id}`
        );
      } catch (e: any) {
        return errorResult(e.message);
      }
    });

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

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