Skip to main content
Glama
justmytwospence

ynab-mcp

get_budget

Retrieve detailed information for a specific YNAB budget, including all accounts, categories, and transactions. Use 'last-used' to access your most recent budget or specify a budget ID.

Instructions

[1 API call] Get a single budget's full detail including all entities. Use 'last-used' for the most recently accessed budget.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idNoBudget ID or 'last-used'last-used
last_knowledge_of_serverNoDelta request - only return entities changed since this server knowledge value

Implementation Reference

  • The handler function for "get_budget" tool, which uses the YNAB client to fetch budget details.
    server.registerTool("get_budget", {
      title: "Get Budget",
      description: "[1 API call] Get a single budget's full detail including all entities. Use 'last-used' for the most recently accessed budget.",
      inputSchema: {
        budget_id: z.string().default("last-used").describe("Budget ID or 'last-used'"),
        last_knowledge_of_server: z.number().optional().describe("Delta request - only return entities changed since this server knowledge value"),
      },
      annotations: { readOnlyHint: true },
    }, async ({ budget_id, last_knowledge_of_server }) => {
      try {
        const response = await getClient().plans.getPlanById(budget_id, last_knowledge_of_server);
        const b = response.data.plan;
        const summary = [
          `Budget: ${b.name}`,
          `ID: ${b.id}`,
          `Last Modified: ${b.last_modified_on}`,
          `Accounts: ${b.accounts?.length ?? 0}`,
          `Categories: ${b.categories?.length ?? 0}`,
          `Payees: ${b.payees?.length ?? 0}`,
          `Transactions: ${b.transactions?.length ?? 0}`,
          `Scheduled Transactions: ${b.scheduled_transactions?.length ?? 0}`,
          `Server Knowledge: ${response.data.server_knowledge}`,
        ];
        return textResult(summary.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