Skip to main content
Glama
calebl

YNAB MCP Server

by calebl

List Months

ynab_list_months

Retrieve all budget months with summary information on income, activity, and budgeted amounts to quickly review budgeting status for any specified budget.

Instructions

Lists all budget months. Each month contains summary information about budgeting status.

Input Schema

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

Implementation Reference

  • The execute function that calls the YNAB API to list budget months, formats the response with income/budgeted/activity/to_be_budgeted values, and returns the result.
    export async function execute(input: ListMonthsInput, api: ynab.API) {
      try {
        const budgetId = getBudgetId(input.budgetId);
    
        console.error(`Listing months for budget ${budgetId}`);
        const response = await api.months.getBudgetMonths(budgetId);
    
        // Format the months
        const months = response.data.months.map((month) => ({
          month: month.month,
          note: month.note,
          income: (month.income / 1000).toFixed(2),
          budgeted: (month.budgeted / 1000).toFixed(2),
          activity: (month.activity / 1000).toFixed(2),
          to_be_budgeted: (month.to_be_budgeted / 1000).toFixed(2),
          age_of_money: month.age_of_money,
        }));
    
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify({
              months,
              month_count: months.length,
            }, null, 2),
          }],
        };
      } catch (error) {
        console.error("Error listing months:", error);
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify({
              success: false,
              error: getErrorMessage(error),
            }, null, 2),
          }],
        };
      }
    }
  • Input schema definition using zod - accepts an optional budgetId string 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:123-127 (registration)
    Registration of the tool with the MCP server using server.registerTool(), binding the name, description, inputSchema, and execute handler.
    server.registerTool(ListMonthsTool.name, {
      title: "List Months",
      description: ListMonthsTool.description,
      inputSchema: ListMonthsTool.inputSchema,
    }, async (input) => ListMonthsTool.execute(input, api));
  • Helper function getBudgetId() that resolves the budget ID from input or falls back to the YNAB_BUDGET_ID environment variable.
    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;
    }
  • Tool name constant 'ynab_list_months' and description exported from the tool module.
    export const name = "ynab_list_months";
Behavior3/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. It states the tool lists budget months (implying a read operation) and mentions monthly summaries but does not disclose pagination, sorting, error handling, or the exact meaning of 'summary information'. Adequate for a simple read tool but lacks depth.

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

Conciseness5/5

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

The description is two concise sentences with no fluff. Each sentence provides essential information: the action (list all budget months) and the content (summary information about budgeting status). No unnecessary words.

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

Completeness4/5

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

For a simple read tool with one optional parameter and no output schema, the description is mostly complete. It covers what the tool does and what the result contains. However, it could be slightly richer by noting that the output is a list or mentioning the default budget behavior, but overall adequate.

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 input schema covers the single parameter (budgetId) with full description, including its optional nature and default from an environment variable. The description adds no additional parameter information beyond the schema, so baseline score applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool lists all budget months and that each month contains summary information about budgeting status. It distinguishes itself from sibling tools like ynab_list_accounts or ynab_list_budgets by focusing on months, though it does not explicitly differentiate.

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 lacks context such as prerequisites or typical use cases, leaving the agent to infer usage from the name 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