get_single_category
Retrieve detailed information for a specific financial category in LunchMoney, including inherited properties from category groups when applicable.
Instructions
Get hydrated details on a single category. Note that if this category is part of a category group, its properties (is_income, exclude_from_budget, exclude_from_totals) will inherit from the category group.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes |
Implementation Reference
- src/tools/categories.ts:65-95 (handler)Handler function that executes the tool: fetches category details from Lunchmoney API by ID and returns JSON.async ({ input }) => { const { categoryId } = input; const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/categories/${categoryId}`, { headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, }, }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to get single category: ${response.statusText}`, }, ], }; } const category: Category = await response.json(); return { content: [ { type: "text", text: JSON.stringify(category), }, ], }; }
- src/tools/categories.ts:57-64 (schema)Zod input schema requiring a categoryId string.input: z.object({ categoryId: z .string() .describe( "Id of the category to query. Should call the get_all_categories tool first to get the ids." ), }), },
- src/tools/categories.ts:53-96 (registration)Registration of the get_single_category tool using server.tool(), including name, description, schema, and handler.server.tool( "get_single_category", "Get hydrated details on a single category. Note that if this category is part of a category group, its properties (is_income, exclude_from_budget, exclude_from_totals) will inherit from the category group.", { input: z.object({ categoryId: z .string() .describe( "Id of the category to query. Should call the get_all_categories tool first to get the ids." ), }), }, async ({ input }) => { const { categoryId } = input; const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/categories/${categoryId}`, { headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, }, }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to get single category: ${response.statusText}`, }, ], }; } const category: Category = await response.json(); return { content: [ { type: "text", text: JSON.stringify(category), }, ], }; } );
- src/index.ts:24-24 (registration)Top-level call to register all category tools, including get_single_category.registerCategoryTools(server);