get_category
Retrieve specific category details from a YNAB budget to view spending limits, balances, and financial tracking information.
Instructions
[1 API call] Get details for a single category
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| budget_id | No | Budget ID or 'last-used' | last-used |
| category_id | Yes | The category ID |
Implementation Reference
- src/tools/categories.ts:38-67 (handler)The tool "get_category" is registered and handled within this block, calling the YNAB client's `getCategoryById` method.
server.registerTool("get_category", { title: "Get Category", description: "[1 API call] Get details for a single category", inputSchema: { budget_id: z.string().default("last-used").describe("Budget ID or 'last-used'"), category_id: z.string().describe("The category ID"), }, annotations: { readOnlyHint: true }, }, async ({ budget_id, category_id }) => { try { const response = await getClient().categories.getCategoryById(budget_id, category_id); const c = response.data.category; const lines = [ `Name: ${c.name}`, `Category Group: ${c.category_group_name}`, `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"}`, `Goal Target Month: ${c.goal_target_month ?? "None"}`, `Note: ${c.note ?? "None"}`, `Hidden: ${c.hidden}`, `ID: ${c.id}`, ]; return textResult(lines.join("\n")); } catch (e: any) { return errorResult(e.message); } });