Skip to main content
Glama
calebl

YNAB MCP Server

by calebl

ynab_list_scheduled_transactions

View all scheduled recurring transactions in your YNAB budget to track upcoming payments and manage cash flow.

Instructions

Lists all scheduled (recurring) transactions in a budget.

Input Schema

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

Implementation Reference

  • The execute function implementing the core logic: retrieves scheduled transactions from YNAB API, filters out deleted ones, formats the data, and returns it as JSON-formatted text content or error.
    export async function execute(input: ListScheduledTransactionsInput, api: ynab.API) {
      try {
        const budgetId = getBudgetId(input.budgetId);
    
        console.error(`Listing scheduled transactions for budget ${budgetId}`);
        const response = await api.scheduledTransactions.getScheduledTransactions(budgetId);
    
        // Filter and format scheduled transactions
        const scheduledTransactions = response.data.scheduled_transactions
          .filter((txn) => !txn.deleted)
          .map((txn) => ({
            id: txn.id,
            date_first: txn.date_first,
            date_next: txn.date_next,
            frequency: txn.frequency,
            amount: (txn.amount / 1000).toFixed(2),
            memo: txn.memo,
            flag_color: txn.flag_color,
            account_id: txn.account_id,
            account_name: txn.account_name,
            payee_id: txn.payee_id,
            payee_name: txn.payee_name,
            category_id: txn.category_id,
            category_name: txn.category_name,
            transfer_account_id: txn.transfer_account_id,
          }));
    
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify({
              scheduled_transactions: scheduledTransactions,
              count: scheduledTransactions.length,
            }, null, 2),
          }],
        };
      } catch (error) {
        console.error("Error listing scheduled transactions:", error);
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify({
              success: false,
              error: getErrorMessage(error),
            }, null, 2),
          }],
        };
      }
    }
  • Input schema definition using Zod for optional budgetId parameter.
    export const inputSchema = {
      budgetId: z.string().optional().describe("The ID of the budget (optional, defaults to YNAB_BUDGET_ID environment variable)"),
    };
  • src/index.ts:111-115 (registration)
    Registers the tool with the MCP server, providing name, title, description, inputSchema, and the async handler wrapping the execute function with the YNAB API instance.
    server.registerTool(ListScheduledTransactionsTool.name, {
      title: "List Scheduled Transactions",
      description: ListScheduledTransactionsTool.description,
      inputSchema: ListScheduledTransactionsTool.inputSchema,
    }, async (input) => ListScheduledTransactionsTool.execute(input, api));

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