list_months
Retrieve all budget months with summaries showing income, budgeted amounts, and activity totals for YNAB budget management.
Instructions
Get all budget months. Returns month summaries with income, budgeted, and activity totals.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| budget_id | Yes | The budget ID |
Implementation Reference
- src/index.ts:106-108 (handler)The core handler function in the YNABClient class that fetches the list of months for a given budget from the YNAB API.async listMonths(budgetId: string) { return this.request<{ months: any[] }>(`/budgets/${budgetId}/months`); }
- src/index.ts:116-118 (schema)Zod schema used for input validation of budget_id parameter in the list_months tool handler.const BudgetIdSchema = z.object({ budget_id: z.string().describe("The budget ID (use 'last-used' for most recent)"), });
- src/index.ts:267-277 (registration)Registration of the list_months tool in the tools array provided to the MCP ListToolsRequest, including name, description, and input schema.{ name: "list_months", description: "Get all budget months. Returns month summaries with income, budgeted, and activity totals.", inputSchema: { type: "object" as const, properties: { budget_id: { type: "string", description: "The budget ID" }, }, required: ["budget_id"], }, },
- src/index.ts:379-383 (helper)Dispatch logic in the MCP CallToolRequest handler that validates input and invokes the list_months implementation.case "list_months": { const { budget_id } = BudgetIdSchema.parse(args); result = await client.listMonths(budget_id); break; }