Skip to main content
Glama
justmytwospence

ynab-mcp

get_transaction

Retrieve specific transaction details from YNAB budgets to view spending, track expenses, or verify financial records.

Instructions

[1 API call] Get details for a single transaction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idNoBudget ID or 'last-used'last-used
transaction_idYesThe transaction ID

Implementation Reference

  • The handler and registration for the 'get_transaction' tool.
    server.registerTool("get_transaction", {
      title: "Get Transaction",
      description: "[1 API call] Get details for a single transaction",
      inputSchema: {
        budget_id: z.string().default("last-used").describe("Budget ID or 'last-used'"),
        transaction_id: z.string().describe("The transaction ID"),
      },
      annotations: { readOnlyHint: true },
    }, async ({ budget_id, transaction_id }) => {
      try {
        const response = await getClient().transactions.getTransactionById(budget_id, transaction_id);
        const t = response.data.transaction;
        const lines = [
          `Date: ${t.date}`,
          `Amount: ${formatCurrency(t.amount)}`,
          `Payee: ${t.payee_name ?? "None"} (ID: ${t.payee_id ?? "N/A"})`,
          `Category: ${t.category_name ?? "Uncategorized"} (ID: ${t.category_id ?? "N/A"})`,
          `Account: ${t.account_name} (ID: ${t.account_id})`,
          `Memo: ${t.memo ?? "None"}`,
          `Cleared: ${t.cleared}`,
          `Approved: ${t.approved}`,
          `Flag: ${t.flag_color ?? "None"}`,
          `Transfer Account: ${t.transfer_account_id ?? "None"}`,
          `ID: ${t.id}`,
        ];
        if (t.subtransactions && t.subtransactions.length > 0) {
          lines.push(`\nSplit Transactions:`);
          for (const sub of t.subtransactions) {
            lines.push(`  - ${formatCurrency(sub.amount)} | ${sub.category_name ?? "Uncategorized"} | ${sub.memo ?? ""}`);
          }
        }
        return textResult(lines.join("\n"));
      } 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