Skip to main content
Glama
justmytwospence

ynab-mcp

Create Transaction

create_transaction

Add new transactions to YNAB budgets with specified amounts, dates, and accounts. Supports split transactions by setting category to null and providing subtransactions.

Instructions

[1 API call] Create a new transaction. Amounts are in dollars (positive for inflows, negative for outflows). For split transactions, set category_id to null and provide subtransactions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idNoBudget ID or 'last-used'last-used
account_idYesAccount ID for the transaction
dateYesTransaction date (YYYY-MM-DD)
amountYesAmount in dollars (negative for outflows, e.g., -25.50)
payee_idNoPayee ID (if known)
payee_nameNoPayee name (will match or create payee)
category_idNoCategory ID (omit for split transactions)
memoNoTransaction memo
clearedNoCleared status
approvedNoWhether the transaction is approved (default: false)
flag_colorNoFlag color
subtransactionsNoSplit transaction parts (amounts must sum to the total)

Implementation Reference

  • The `create_transaction` tool is registered and implemented here, handling input validation through zod and executing the API call using the YNAB client.
    server.registerTool("create_transaction", {
      title: "Create Transaction",
      description: "[1 API call] Create a new transaction. Amounts are in dollars (positive for inflows, negative for outflows). For split transactions, set category_id to null and provide subtransactions.",
      inputSchema: {
        budget_id: z.string().default("last-used").describe("Budget ID or 'last-used'"),
        account_id: z.string().describe("Account ID for the transaction"),
        date: z.string().describe("Transaction date (YYYY-MM-DD)"),
        amount: z.number().describe("Amount in dollars (negative for outflows, e.g., -25.50)"),
        payee_id: z.string().optional().describe("Payee ID (if known)"),
        payee_name: z.string().optional().describe("Payee name (will match or create payee)"),
        category_id: z.string().optional().describe("Category ID (omit for split transactions)"),
        memo: z.string().optional().describe("Transaction memo"),
        cleared: z.enum(CLEARED_VALUES).optional().describe("Cleared status"),
        approved: z.boolean().optional().describe("Whether the transaction is approved (default: false)"),
        flag_color: z.enum(FLAG_COLORS).optional().describe("Flag color"),
        subtransactions: z.array(z.object({
          amount: z.number().describe("Subtransaction amount in dollars"),
          payee_id: z.string().optional(),
          payee_name: z.string().optional(),
          category_id: z.string().optional(),
          memo: z.string().optional(),
        })).optional().describe("Split transaction parts (amounts must sum to the total)"),
      },
      annotations: { readOnlyHint: false },
    }, async ({ budget_id, account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, subtransactions }) => {
      try {
        const response = await getClient().transactions.createTransaction(budget_id, {
          transaction: {
            account_id,
            date,
            amount: dollarsToMilliunits(amount),
            payee_id,
            payee_name,
            category_id,
            memo,
            cleared,
            approved,
            flag_color: flag_color ?? null,
            subtransactions: subtransactions?.map((s) => ({
              amount: dollarsToMilliunits(s.amount),
              payee_id: s.payee_id,
              payee_name: s.payee_name,
              category_id: s.category_id,
              memo: s.memo,
            })),
          },
        });
        const t = response.data.transaction;
        if (t) {
          return textResult(
            `Created transaction: ${t.date} | ${formatCurrency(t.amount)} | ${t.payee_name ?? "No payee"} | ${t.category_name ?? "Uncategorized"}\nID: ${t.id}`
          );
        }
        const txns = response.data.transactions;
        return textResult(`Created ${txns?.length ?? 0} transaction(s).`);
      } catch (e: any) {
        return errorResult(e.message);
      }
    });
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds useful behavioral context beyond the annotations: it clarifies that amounts are in dollars with positive/negative conventions, explains how split transactions work, and mentions '[1 API call]' which suggests a single operation. The annotations only indicate readOnlyHint=false (implying mutation), so the description provides additional implementation details without contradicting the annotations.

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 extremely concise (three sentences) with zero wasted words. It front-loads the core purpose, then provides essential behavioral context, and finally gives specific usage guidance for split transactions. Every sentence earns its place by adding distinct value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no output schema, the description provides good context about the operation's behavior (dollar amounts, split transactions, API call count). However, it doesn't mention potential side effects, error conditions, or what happens when payee_name creates a new payee. Given the complexity of 12 parameters and mutation nature, some additional context would be helpful.

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?

With 100% schema description coverage, the input schema already documents all 12 parameters thoroughly. The description adds minimal parameter semantics beyond the schema - it clarifies the dollar unit and sign convention for 'amount', and explains the relationship between 'category_id' and 'subtransactions' for splits. This meets the baseline for high schema coverage.

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 ('Create a new transaction') and resource ('transaction'), distinguishing it from sibling tools like 'create_transactions' (plural) or 'update_transaction'. It provides essential context about amounts in dollars with sign conventions, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear guidance on when to use this tool for split transactions ('set category_id to null and provide subtransactions'), which helps differentiate from non-split scenarios. However, it doesn't explicitly mention when NOT to use it or name specific alternatives among the many sibling tools (e.g., vs 'create_transactions' or 'import_transactions').

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

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