list_months
Retrieve budget month details including income, budgeted amounts, activity, and ready-to-assign funds for YNAB financial planning.
Instructions
[1 API call] List all budget months for a budget, showing income, budgeted, activity, and ready to assign
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| budget_id | No | Budget ID or 'last-used' | last-used |
| last_knowledge_of_server | No | Delta request token |
Implementation Reference
- src/tools/months.ts:15-28 (handler)The handler function that executes the logic for the "list_months" tool. It calls the YNAB client to fetch plan months and formats the output.
}, async ({ budget_id, last_knowledge_of_server }) => { try { const response = await getClient().months.getPlanMonths(budget_id, last_knowledge_of_server); const months = response.data.months; const lines = months.map((m) => `- ${m.month}: Income ${formatCurrency(m.income)} | Budgeted ${formatCurrency(m.budgeted)} | Activity ${formatCurrency(m.activity)} | To Be Budgeted ${formatCurrency(m.to_be_budgeted)}` ); return textResult( `Budget Months (${months.length}):\n${lines.join("\n")}\n\nServer Knowledge: ${response.data.server_knowledge}` ); } catch (e: any) { return errorResult(e.message); } }); - src/tools/months.ts:7-14 (registration)The registration of the "list_months" tool, including its schema and description.
server.registerTool("list_months", { title: "List Budget Months", description: "[1 API call] List all budget months for a budget, showing income, budgeted, activity, and ready to assign", inputSchema: { budget_id: z.string().default("last-used").describe("Budget ID or 'last-used'"), last_knowledge_of_server: z.number().optional().describe("Delta request token"), }, annotations: { readOnlyHint: true },