Skip to main content
Glama
justmytwospence

ynab-mcp

list_accounts

Retrieve all budget accounts with current balances and account types to monitor financial positions and track spending across categories.

Instructions

[1 API call] List all accounts for a budget including balances and types

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idNoBudget ID or 'last-used'last-used
last_knowledge_of_serverNoDelta request token

Implementation Reference

  • The 'list_accounts' tool registration and handler implementation. It uses the YNAB client to fetch accounts for a given budget and formats the result.
    server.registerTool("list_accounts", {
      title: "List Accounts",
      description: "[1 API call] List all accounts for a budget including balances and types",
      inputSchema: {
        budget_id: z.string().default("last-used").describe("Budget ID or 'last-used'"),
        last_knowledge_of_server: z.number().optional().describe("Delta request token"),
      },
      annotations: { readOnlyHint: true },
    }, async ({ budget_id, last_knowledge_of_server }) => {
      try {
        const response = await getClient().accounts.getAccounts(budget_id, last_knowledge_of_server);
        const accounts = response.data.accounts;
        const lines = accounts.map((a) => {
          const status = a.closed ? " [CLOSED]" : "";
          const onBudget = a.on_budget ? "On Budget" : "Off Budget";
          return `- ${a.name}${status}: ${formatCurrency(a.balance)} (${a.type}, ${onBudget}) [ID: ${a.id}]`;
        });
        return textResult(
          `Accounts (${accounts.length}):\n${lines.join("\n")}\n\nServer Knowledge: ${response.data.server_knowledge}`
        );
      } 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