Skip to main content
Glama
calebl

YNAB MCP Server

by calebl

List Months

ynab_list_months

Retrieve a list of all budget months with summary information about budgeting status for financial tracking and planning.

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 main handler function that executes the tool logic: fetches budget months from YNAB API, formats them, and returns as JSON text response. Handles errors gracefully.
    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),
          }],
        };
      }
    }
  • src/index.ts:123-127 (registration)
    Registers the 'ynab_list_months' tool with the MCP server, providing title, description, input schema, and delegating execution to the tool's execute function.
    server.registerTool(ListMonthsTool.name, {
      title: "List Months",
      description: ListMonthsTool.description,
      inputSchema: ListMonthsTool.inputSchema,
    }, async (input) => ListMonthsTool.execute(input, api));
  • Zod-based input schema defining the optional budgetId parameter for the tool.
    export const inputSchema = {
      budgetId: z.string().optional().describe("The ID of the budget (optional, defaults to YNAB_BUDGET_ID environment variable)"),
    };
  • Helper function to resolve the budget ID from input parameter or YNAB_BUDGET_ID environment variable, throwing error if missing.
    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;
    }
  • src/index.ts:22-22 (registration)
    Import of the ListMonthsTool module in the main index file for registration.
    import * as ListMonthsTool from "./tools/ListMonthsTool.js";
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 states the tool lists months with summary information, but doesn't describe pagination, sorting, rate limits, authentication needs, error conditions, or what 'summary information' entails. For a read operation with zero annotation coverage, this leaves significant behavioral gaps.

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 zero waste. The first sentence states the core purpose, and the second adds valuable context about what each month contains. It's appropriately sized and front-loaded, with every sentence earning its place.

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

Completeness3/5

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

Given the tool's low complexity (1 optional parameter, no output schema), the description is minimally adequate. It covers the basic purpose and output nature, but lacks behavioral details that would be helpful for an agent, especially without annotations. It's complete enough for a simple list operation but could be more informative.

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?

Schema description coverage is 100%, with the single parameter 'budgetId' fully documented in the schema as optional with a default. The description adds no parameter-specific information beyond what the schema provides, so it meets the baseline of 3 where the schema does the heavy lifting.

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 the verb ('Lists') and resource ('all budget months') with specific scope ('Each month contains summary information about budgeting status'). It distinguishes from siblings like 'ynab_budget_summary' by focusing on monthly granularity rather than overall budget. However, it doesn't explicitly differentiate from other list tools like 'ynab_list_accounts' or 'ynab_list_categories' beyond the resource type.

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?

No explicit guidance on when to use this tool versus alternatives is provided. The description doesn't mention prerequisites, timing considerations, or comparisons to sibling tools like 'ynab_budget_summary' or 'ynab_get_transactions'. Usage is implied through the action and resource, but no contextual boundaries are defined.

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