Skip to main content
Glama
justmytwospence

ynab-mcp

list_budgets

Retrieve all accessible budgets from YNAB with optional account details to view financial overviews and manage resources.

Instructions

[1 API call] List all budgets the user has access to, with optional account info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_accountsNoInclude accounts for each budget

Implementation Reference

  • Implementation and registration of the 'list_budgets' tool. It fetches budgets using the YNAB client and formats them as a text result.
    server.registerTool("list_budgets", {
      title: "List Budgets",
      description: "[1 API call] List all budgets the user has access to, with optional account info",
      inputSchema: {
        include_accounts: z.boolean().optional().describe("Include accounts for each budget"),
      },
      annotations: { readOnlyHint: true },
    }, async ({ include_accounts }) => {
      try {
        const response = await getClient().plans.getPlans(include_accounts);
        const budgets = response.data.plans;
        const lines = budgets.map((b) => {
          let line = `- ${b.name} (ID: ${b.id})`;
          if (b.last_modified_on) line += ` [Last modified: ${b.last_modified_on}]`;
          if (include_accounts && b.accounts) {
            for (const a of b.accounts) {
              line += `\n  - ${a.name}: ${formatCurrency(a.balance)} (${a.type})`;
            }
          }
          return line;
        });
        return textResult(`Budgets:\n${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