Skip to main content
Glama
calebl

YNAB MCP Server

by calebl

Bulk Approve Transactions

ynab_bulk_approve_transactions

Approve multiple YNAB transactions simultaneously in a single API call by providing an array of transaction IDs.

Instructions

Approves multiple transactions at once. Provide an array of transaction IDs to approve them all in a single API call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budgetIdNoThe ID of the budget (optional, defaults to YNAB_BUDGET_ID environment variable)
transactionIdsYesArray of transaction IDs to approve

Implementation Reference

  • The execute function that handles the bulk approve transactions logic. It maps transaction IDs to approved:true, calls api.transactions.updateTransactions, formats the response, and returns a success/error result.
    export async function execute(input: BulkApproveTransactionsInput, api: ynab.API) {
      try {
        const budgetId = getBudgetId(input.budgetId);
    
        if (!input.transactionIds || input.transactionIds.length === 0) {
          throw new Error("No transaction IDs provided");
        }
    
        // Build the update transactions array
        const transactions: ynab.SaveTransactionWithIdOrImportId[] = input.transactionIds.map((id) => ({
          id,
          approved: true,
        }));
    
        const response = await api.transactions.updateTransactions(budgetId, {
          transactions,
        });
    
        if (!response.data.transactions) {
          throw new Error("Failed to update transactions - no transaction data returned");
        }
    
        const updatedTransactions = response.data.transactions.map((txn) => ({
          id: txn.id,
          date: txn.date,
          amount: (txn.amount / 1000).toFixed(2),
          payee_name: txn.payee_name,
          approved: txn.approved,
        }));
    
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify({
              success: true,
              approved_count: updatedTransactions.length,
              transactions: updatedTransactions,
              message: `Successfully approved ${updatedTransactions.length} transaction(s)`,
            }, null, 2),
          }],
        };
      } catch (error) {
        console.error("Error bulk approving transactions:", error);
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify({
              success: false,
              error: getErrorMessage(error),
            }, null, 2),
          }],
        };
      }
    }
  • Exported name, description, and input schema (budgetId optional string, transactionIds array of strings) for the tool.
    export const name = "ynab_bulk_approve_transactions";
    export const description = "Approves multiple transactions at once. Provide an array of transaction IDs to approve them all in a single API call.";
    export const inputSchema = {
      budgetId: z.string().optional().describe("The ID of the budget (optional, defaults to YNAB_BUDGET_ID environment variable)"),
      transactionIds: z.array(z.string()).describe("Array of transaction IDs to approve"),
    };
  • Helper function getBudgetId that resolves the budget ID from input or the YNAB_BUDGET_ID environment variable.
    function getBudgetId(inputBudgetId?: string): string {
      const budgetId = inputBudgetId || process.env.YNAB_BUDGET_ID || "";
      if (!budgetId) {
        throw new Error("No budget ID provided. Please provide a budget ID or set the YNAB_BUDGET_ID environment variable.");
      }
      return budgetId;
    }
  • src/index.ts:75-79 (registration)
    Registration of the tool on the MCP server using server.registerTool with the name 'ynab_bulk_approve_transactions'.
    server.registerTool(BulkApproveTransactionsTool.name, {
      title: "Bulk Approve Transactions",
      description: BulkApproveTransactionsTool.description,
      inputSchema: BulkApproveTransactionsTool.inputSchema,
    }, async (input) => BulkApproveTransactionsTool.execute(input, api));
  • src/index.ts:14-14 (registration)
    Import of BulkApproveTransactionsTool module.
    import * as BulkApproveTransactionsTool from "./tools/BulkApproveTransactionsTool.js";
Behavior2/5

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

No annotations are provided, so the description must carry the full burden. It merely states 'Approves' without disclosing side effects, permission requirements, rate limits, or error handling. For a mutation operation, this is insufficient.

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 with two short sentences, no fluff, and the key information is front-loaded.

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

Completeness3/5

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

The description covers the basic function but lacks details on expected behavior (e.g., partial success, idempotency, response structure). Given the simplicity, it is minimally adequate but could be more complete.

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?

Schema description coverage is 100%, so the schema already documents both parameters. The description adds no new meaning beyond restating the need for transaction IDs, which is already in the schema. Baseline 3 is appropriate.

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 explicitly states the verb 'Approves' and the resource 'multiple transactions', clearly differentiating from the sibling tool 'ynab_approve_transaction' which handles single transactions. The phrase 'at once' and 'bulk' reinforce the batch nature.

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

Usage Guidelines3/5

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

The description implies usage for approving multiple transactions in one call but does not explicitly state when to use versus calling the single-approve tool multiple times. No when-not scenarios or alternatives are mentioned.

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

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