update_category
Modify an existing budget category's name, note, or goal details in YNAB to reflect changes in financial planning or organization.
Instructions
[1 API call] Update an existing category's name, note, or goal
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| budget_id | No | Budget ID or 'last-used' | last-used |
| category_id | Yes | The category ID to update | |
| name | No | New category name | |
| note | No | New category note | |
| goal_target | No | New goal target in dollars | |
| goal_target_date | No | New goal target date (YYYY-MM-DD) |
Implementation Reference
- src/tools/categories.ts:99-126 (handler)The registration and handler implementation for the update_category tool.
server.registerTool("update_category", { title: "Update Category", description: "[1 API call] Update an existing category's name, note, or goal", inputSchema: { budget_id: z.string().default("last-used").describe("Budget ID or 'last-used'"), category_id: z.string().describe("The category ID to update"), name: z.string().optional().describe("New category name"), note: z.string().optional().describe("New category note"), goal_target: z.number().optional().describe("New goal target in dollars"), goal_target_date: z.string().optional().describe("New goal target date (YYYY-MM-DD)"), }, annotations: { readOnlyHint: false }, }, async ({ budget_id, category_id, name, note, goal_target, goal_target_date }) => { try { const response = await getClient().categories.updateCategory(budget_id, category_id, { category: { name, note, goal_target: goal_target != null ? dollarsToMilliunits(goal_target) : undefined, goal_target_date, }, }); const c = response.data.category; return textResult(`Updated category "${c.name}"\nID: ${c.id}`); } catch (e: any) { return errorResult(e.message); } });