get_month_category
Retrieve a category's budget details for a specific month from YNAB to track spending and manage financial allocations.
Instructions
[1 API call] Get a category's budget details for a specific month
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| budget_id | No | Budget ID or 'last-used' | last-used |
| month | Yes | Month in YYYY-MM-DD format (first of month) or 'current' | |
| category_id | Yes | The category ID |
Implementation Reference
- src/tools/categories.ts:128-153 (handler)The tool "get_month_category" is registered here with its input schema and handler function, which calls the YNAB client to retrieve budget category details for a specific month.
server.registerTool("get_month_category", { title: "Get Month Category", description: "[1 API call] Get a category's budget details for a specific month", inputSchema: { budget_id: z.string().default("last-used").describe("Budget ID or 'last-used'"), month: z.string().describe("Month in YYYY-MM-DD format (first of month) or 'current'"), category_id: z.string().describe("The category ID"), }, annotations: { readOnlyHint: true }, }, async ({ budget_id, month, category_id }) => { try { const response = await getClient().categories.getMonthCategoryById(budget_id, month, category_id); const c = response.data.category; const lines = [ `Category: ${c.name} (${month})`, `Budgeted: ${formatCurrency(c.budgeted)}`, `Activity: ${formatCurrency(c.activity)}`, `Balance: ${formatCurrency(c.balance)}`, `Goal Type: ${c.goal_type ?? "None"}`, `Goal Target: ${c.goal_target != null ? formatCurrency(c.goal_target) : "None"}`, ]; return textResult(lines.join("\n")); } catch (e: any) { return errorResult(e.message); } });