Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

delete_category

Destructive

Delete a category or category group. Force deletion to remove all associated budgets and transactions (irreversible).

Instructions

Delete a single category or category group. By default fails (HTTP 422) if dependencies exist, returning a structured dependents payload. Set force=true to delete and disassociate from all related budgets, transactions, recurring items, etc. Force delete is irreversible.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
category_idYesId of the category or category group to delete.
forceNoIf true, force deletion even if dependencies exist (irreversible).

Implementation Reference

  • Registration of the 'delete_category' tool with the MCP server, including its input schema (category_id required, force optional) and the async handler that calls DELETE /categories/{id} API endpoint.
    server.registerTool(
        "delete_category",
        {
            description:
                "Delete a single category or category group. By default fails (HTTP 422) if dependencies exist, returning a structured `dependents` payload. Set force=true to delete and disassociate from all related budgets, transactions, recurring items, etc. Force delete is irreversible.",
            inputSchema: {
                category_id: z.coerce
                    .number()
                    .describe(
                        "Id of the category or category group to delete.",
                    ),
                force: z
                    .boolean()
                    .optional()
                    .describe(
                        "If true, force deletion even if dependencies exist (irreversible).",
                    ),
            },
            annotations: {
                destructiveHint: true,
            },
        },
        async ({ category_id, force }) => {
            try {
                const path = force
                    ? `/categories/${category_id}?force=true`
                    : `/categories/${category_id}`;
                const response = await api.delete(path);
    
                if (response.status === 204) {
                    return successResponse("Category deleted.");
                }
    
                if (!response.ok) {
                    if (response.status === 422) {
                        return dataResponse(await response.json());
                    }
                    return handleApiError(
                        response,
                        "Failed to delete category",
                    );
                }
    
                return dataResponse(await response.json());
            } catch (error) {
                return catchError(error, "Failed to delete category");
            }
        },
    );
  • Input schema for the delete_category tool: requires category_id (number) and optionally force (boolean). Annotated as destructive.
        inputSchema: {
            category_id: z.coerce
                .number()
                .describe(
                    "Id of the category or category group to delete.",
                ),
            force: z
                .boolean()
                .optional()
                .describe(
                    "If true, force deletion even if dependencies exist (irreversible).",
                ),
        },
        annotations: {
            destructiveHint: true,
        },
    },
  • Handler function for delete_category: sends DELETE request to /categories/{id} (with ?force=true if force flag set). Handles 204 (success with no content), 422 (dependencies exist, returns dependents payload), and other errors.
    async ({ category_id, force }) => {
        try {
            const path = force
                ? `/categories/${category_id}?force=true`
                : `/categories/${category_id}`;
            const response = await api.delete(path);
    
            if (response.status === 204) {
                return successResponse("Category deleted.");
            }
    
            if (!response.ok) {
                if (response.status === 422) {
                    return dataResponse(await response.json());
                }
                return handleApiError(
                    response,
                    "Failed to delete category",
                );
            }
    
            return dataResponse(await response.json());
        } catch (error) {
            return catchError(error, "Failed to delete category");
        }
    },
  • Type definition for the response payload when deletion is blocked due to existing dependencies (HTTP 422). Contains the category name and counts of dependents across budgets, rules, transactions, children, recurring items, and Plaid categories.
    export interface DeleteCategoryWithDependencies {
        category_name: string;
        dependents: {
            budget: number;
            category_rules: number;
            transactions: number;
            children: number;
            recurring: number;
            plaid_cats: number;
        };
    }
Behavior5/5

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

Beyond the destructiveHint annotation, the description adds critical context: the HTTP 422 failure with structured `dependents` payload, and that force delete is irreversible. This fully informs the agent of the tool's safety profile.

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?

Three sentences, each earning its place: main action, default behavior with failure mode, and force option with implication. No redundant words.

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

Completeness5/5

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

For a two-parameter destructive tool with a clear annotation, the description covers all needed context: default behavior, alternative force behavior, and consequences. No gaps remain.

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

Parameters5/5

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

Schema coverage is 100% and the description adds meaning: it explains that `force=true` allows deletion despite dependencies and is irreversible. This goes beyond the schema's basic type description.

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

Purpose5/5

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

The description clearly states the verb 'delete' and the resource 'single category or category group'. It distinguishes from sibling tools like delete_tag or delete_transaction by specifying the target type.

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

Usage Guidelines4/5

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

The description explains when to use default (fails if dependencies) and when to use force=true (to override dependencies). It provides clear usage context, though no explicit alternatives are mentioned.

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