Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

add_to_category_group

Organize financial categories by adding existing categories or creating new ones within a specified category group to improve budget management.

Instructions

Add categories (either existing or new) to a single category group.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • The handler function for the 'add_to_category_group' tool. It constructs a request body from category_ids and/or new_categories, then performs a POST request to the LunchMoney API endpoint `/categories/group/${group_id}/add` to add categories to the specified group, returning the JSON response or an error message.
    async ({ input }) => {
        const { group_id, category_ids, new_categories } = input;
        const { baseUrl, lunchmoneyApiToken } = getConfig();
        const requestBody: any = {};
    
        if (category_ids && category_ids.length > 0) {
            requestBody.category_ids = category_ids;
        }
    
        if (new_categories && new_categories.length > 0) {
            requestBody.new_categories = new_categories;
        }
    
        const response = await fetch(
            `${baseUrl}/categories/group/${group_id}/add`,
            {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${lunchmoneyApiToken}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify(requestBody),
            }
        );
    
        if (!response.ok) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Failed to add to a single category group: ${response.statusText}`,
                    },
                ],
            };
        }
    
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(await response.json()),
                },
            ],
        };
    }
  • Zod input schema defining parameters for the 'add_to_category_group' tool: group_id (required number), optional category_ids (array of numbers), and optional new_categories (array of strings).
    input: z.object({
        group_id: z.number().describe("Id of the parent group to add to."),
        category_ids: z
            .array(z.number())
            .optional()
            .describe(
                "Array of category_id to include in the category group."
            ),
        new_categories: z
            .array(z.string())
            .optional()
            .describe(
                "Array of strings representing new categories to create and subsequently include in the category group."
            ),
    }),
  • The server.tool() registration call that defines and registers the 'add_to_category_group' tool, including its name, description, input schema, and handler function within the registerCategoryTools function.
    server.tool(
        "add_to_category_group",
        "Add categories (either existing or new) to a single category group.",
        {
            input: z.object({
                group_id: z.number().describe("Id of the parent group to add to."),
                category_ids: z
                    .array(z.number())
                    .optional()
                    .describe(
                        "Array of category_id to include in the category group."
                    ),
                new_categories: z
                    .array(z.string())
                    .optional()
                    .describe(
                        "Array of strings representing new categories to create and subsequently include in the category group."
                    ),
            }),
        },
        async ({ input }) => {
            const { group_id, category_ids, new_categories } = input;
            const { baseUrl, lunchmoneyApiToken } = getConfig();
            const requestBody: any = {};
    
            if (category_ids && category_ids.length > 0) {
                requestBody.category_ids = category_ids;
            }
    
            if (new_categories && new_categories.length > 0) {
                requestBody.new_categories = new_categories;
            }
    
            const response = await fetch(
                `${baseUrl}/categories/group/${group_id}/add`,
                {
                    method: "POST",
                    headers: {
                        Authorization: `Bearer ${lunchmoneyApiToken}`,
                        "Content-Type": "application/json",
                    },
                    body: JSON.stringify(requestBody),
                }
            );
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to add to a single category group: ${response.statusText}`,
                        },
                    ],
                };
            }
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(await response.json()),
                    },
                ],
            };
        }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states the action without disclosing behavioral traits. It doesn't mention permissions needed, whether the operation is idempotent, how conflicts are handled, or what happens if categories already exist in the group. For a mutation tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action. Every word earns its place with no redundancy or unnecessary elaboration, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations, no output schema, and low schema description coverage, the description is incomplete. It lacks details on error conditions, return values, side effects, or how it interacts with sibling tools, leaving significant gaps for an agent to understand full context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'categories (either existing or new)' which loosely maps to 'category_ids' and 'new_categories' parameters, but with 0% schema description coverage, it doesn't fully compensate. It adds minimal meaning beyond the schema's property names, failing to explain relationships or constraints between parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Add') and resource ('categories to a single category group'), specifying that categories can be either existing or new. However, it doesn't distinguish this tool from potential siblings like 'create_category' or 'update_category' in terms of scope or relationship management.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance is provided on when to use this tool versus alternatives like 'create_category' or 'update_category'. The description implies usage for adding categories to groups but doesn't mention prerequisites, exclusions, or comparative contexts with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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