force_delete_category
Permanently delete a category or category group from LunchMoney, removing all associated transactions, recurring items, and budgets. This action is irreversible and should only be used after verifying data with the standard delete endpoint.
Instructions
Delete a single category or category group and along with it, disassociate the category from any transactions, recurring items, budgets, etc. Note: it is best practice to first try the Delete Category endpoint to ensure you don't accidentally delete any data. Disassociation/deletion of the data arising from this endpoint is irreversible!
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes |
Implementation Reference
- src/tools/categories.ts:556-589 (handler)Handler function that executes the force deletion of a category or category group by sending a DELETE request to the Lunchmoney API's force delete endpoint.async ({ input }) => { const { category_id } = input; const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch( `${baseUrl}/categories/${category_id}/force`, { method: "DELETE", headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, }, } ); if (!response.ok) { return { content: [ { type: "text", text: `Failed to force delete a single category or category group: ${response.statusText}`, }, ], }; } return { content: [ { type: "text", text: JSON.stringify(await response.json()), }, ], }; }
- src/tools/categories.ts:547-555 (schema)Input schema validation using Zod for the force_delete_category tool, specifying the category_id parameter.input: z.object({ category_id: z .number() .optional() .describe( "Id of the category or the category group to delete." ), }), },
- src/tools/categories.ts:543-590 (registration)Registration of the force_delete_category tool using McpServer.tool(), including name, description, input schema, and handler function.server.tool( "force_delete_category", "Delete a single category or category group and along with it, disassociate the category from any transactions, recurring items, budgets, etc. Note: it is best practice to first try the Delete Category endpoint to ensure you don't accidentally delete any data. Disassociation/deletion of the data arising from this endpoint is irreversible!", { input: z.object({ category_id: z .number() .optional() .describe( "Id of the category or the category group to delete." ), }), }, async ({ input }) => { const { category_id } = input; const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch( `${baseUrl}/categories/${category_id}/force`, { method: "DELETE", headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, }, } ); if (!response.ok) { return { content: [ { type: "text", text: `Failed to force delete a single category or category group: ${response.statusText}`, }, ], }; } return { content: [ { type: "text", text: JSON.stringify(await response.json()), }, ], }; } );