Skip to main content
Glama
calebl

YNAB MCP Server

by calebl

Budget Summary

ynab_budget_summary

Analyze monthly budget performance by identifying overspent categories requiring attention and categories with positive balances performing well.

Instructions

Get a summary of the budget for a specific month highlighting overspent categories that need attention and categories with a positive balance that are doing well.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budgetIdNoThe ID of the budget to get a summary for (optional, defaults to the budget set in the YNAB_BUDGET_ID environment variable)
monthNoThe budget month in ISO format (e.g. 2016-12-01). The string 'current' can also be used to specify the current calendar month (UTC)current

Implementation Reference

  • The main handler function that fetches active accounts and categories for the specified budget month and returns a JSON summary, handling errors gracefully.
    export async function execute(input: BudgetSummaryInput, api: ynab.API) {
      try {
        const budgetId = getBudgetId(input.budgetId);
        const month = input.month || "current";
    
        console.error(`Getting accounts and categories for budget ${budgetId} and month ${month}`);
        const accountsResponse = await api.accounts.getAccounts(budgetId);
        const accounts = accountsResponse.data.accounts.filter(
          (account) => account.deleted === false && account.closed === false
        );
    
        const monthBudget = await api.months.getBudgetMonth(budgetId, month);
    
        const categories = monthBudget.data.month.categories
          .filter(
            (category) => category.deleted === false && category.hidden === false
          );
    
        return {
          content: [{ type: "text" as const, text: JSON.stringify({
            monthBudget: monthBudget.data.month,
            accounts: accounts,
            note: "Divide all numbers by 1000 to get the balance in dollars.",
          }, null, 2) }]
        };
      } catch (error: unknown) {
        console.error("Error getting budget summary:", error);
        return {
          content: [{ type: "text" as const, text: JSON.stringify({
            success: false,
            error: getErrorMessage(error),
          }, null, 2) }]
        };
      }
    }
  • Exports the tool name, description, and Zod input schema defining optional budgetId and month parameters.
    export const name = "ynab_budget_summary";
    export const description = "Get a summary of the budget for a specific month highlighting overspent categories that need attention and categories with a positive balance that are doing well.";
    export const inputSchema = {
      budgetId: z.string().optional().describe("The ID of the budget to get a summary for (optional, defaults to the budget set in the YNAB_BUDGET_ID environment variable)"),
      month: z.string().regex(/^(current|\d{4}-\d{2}-\d{2})$/).default("current").describe("The budget month in ISO format (e.g. 2016-12-01). The string 'current' can also be used to specify the current calendar month (UTC)"),
    };
  • src/index.ts:45-49 (registration)
    Registers the ynab_budget_summary tool with the MCP server using the imported name, description, inputSchema, and a wrapper around the execute handler.
    server.registerTool(BudgetSummaryTool.name, {
      title: "Budget Summary",
      description: BudgetSummaryTool.description,
      inputSchema: BudgetSummaryTool.inputSchema,
    }, async (input) => BudgetSummaryTool.execute(input, api));
  • Helper function to retrieve the budget ID from input or environment variable, throwing an error if not available.
    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;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool 'highlights' overspent and positive categories, implying a read-only analytical function, but fails to specify critical details like whether it requires authentication, how it handles missing data, rate limits, or the format of the summary output. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Get a summary of the budget for a specific month') and adds value by specifying what the summary highlights. There is no wasted verbiage, though it could be slightly more structured (e.g., separating purpose from output details).

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete for a tool that provides analytical insights. It does not cover the return format (e.g., structured data vs. text summary), error handling, or dependencies on other tools (like needing a budget from 'ynab_list_budgets'). For a read-only tool with no structured output documentation, this leaves the agent under-informed.

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?

The schema description coverage is 100%, with both parameters ('budgetId' and 'month') well-documented in the schema itself. The description does not add any meaningful semantic details beyond what the schema provides (e.g., it doesn't explain the implications of 'current' month or how budget ID defaults work). Baseline 3 is appropriate as the schema does the heavy lifting.

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 clearly states the specific action ('Get a summary') and resource ('budget for a specific month'), with explicit details about what the summary highlights ('overspent categories that need attention and categories with a positive balance that are doing well'). It distinguishes this tool from siblings like 'ynab_list_budgets' (which lists budgets) or 'ynab_list_months' (which lists months) by focusing on analytical insights rather than raw data retrieval.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites (e.g., needing a budget ID), exclusions (e.g., not for historical data beyond available months), or comparisons to sibling tools like 'ynab_list_categories' for category-level details. The agent must infer usage from the purpose alone.

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