Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

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
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • 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),
                },
            ],
        };
    }
  • 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."
                ),
        }),
    },
  • 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);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/akutishevsky/lunchmoney-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server