Skip to main content
Glama
justmytwospence

ynab-mcp

create_transactions

Add multiple financial records to YNAB budgets in bulk by specifying account, date, and amount for each transaction.

Instructions

[1 API call, bulk] Create multiple transactions at once. Each transaction needs account_id, date, and amount at minimum.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idNoBudget ID or 'last-used'last-used
transactionsYesArray of transactions to create

Implementation Reference

  • The `create_transactions` tool is defined here, including its input schema and handler function which calls the underlying API to create multiple transactions.
    server.registerTool("create_transactions", {
      title: "Create Multiple Transactions",
      description: "[1 API call, bulk] Create multiple transactions at once. Each transaction needs account_id, date, and amount at minimum.",
      inputSchema: {
        budget_id: z.string().default("last-used").describe("Budget ID or 'last-used'"),
        transactions: z.array(z.object({
          account_id: z.string().describe("Account ID"),
          date: z.string().describe("Date (YYYY-MM-DD)"),
          amount: z.number().describe("Amount in dollars (negative for outflows)"),
          payee_id: z.string().optional(),
          payee_name: z.string().optional(),
          category_id: z.string().optional(),
          memo: z.string().optional(),
          cleared: z.enum(CLEARED_VALUES).optional(),
          approved: z.boolean().optional(),
          flag_color: z.enum(FLAG_COLORS).optional(),
        })).describe("Array of transactions to create"),
      },
      annotations: { readOnlyHint: false },
    }, async ({ budget_id, transactions }) => {
      try {
        const response = await getClient().transactions.createTransaction(budget_id, {
          transactions: transactions.map((t) => ({
            account_id: t.account_id,
            date: t.date,
            amount: dollarsToMilliunits(t.amount),
            payee_id: t.payee_id,
            payee_name: t.payee_name,
            category_id: t.category_id,
            memo: t.memo,
            cleared: t.cleared,
            approved: t.approved,
            flag_color: t.flag_color ?? null,
          })),
        });
        const created = response.data.transactions;
        return textResult(`Created ${created?.length ?? 0} transaction(s).`);
      } 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