Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

remove_budget

Delete a budget assigned to a specific category for a given month in LunchMoney, helping users manage their financial planning by removing outdated or incorrect budget allocations.

Instructions

Remove a budget for a specific category and month

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • The handler function for the 'remove_budget' tool. It constructs a DELETE request to the Lunch Money API to remove the budget for the specified category and month, returning success or error message.
    async ({ input }) => {
        const { baseUrl, lunchmoneyApiToken } = getConfig();
    
        const params = new URLSearchParams({
            start_date: input.start_date,
            category_id: input.category_id.toString(),
        });
    
        const response = await fetch(`${baseUrl}/budgets?${params}`, {
            method: "DELETE",
            headers: {
                Authorization: `Bearer ${lunchmoneyApiToken}`,
            },
        });
    
        if (!response.ok) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Failed to remove budget: ${response.statusText}`,
                    },
                ],
            };
        }
    
        return {
            content: [
                {
                    type: "text",
                    text: "Budget removed successfully",
                },
            ],
        };
    }
  • Zod input schema defining parameters for the 'remove_budget' tool: start_date (string) and category_id (number).
    input: z.object({
        start_date: z
            .string()
            .describe("Budget month start date in YYYY-MM-DD format"),
        category_id: z
            .number()
            .describe("Category ID for the budget to remove"),
    }),
  • Registration of the 'remove_budget' tool on the MCP server within the registerBudgetTools function, including description, input schema, and inline handler.
    server.tool(
        "remove_budget",
        "Remove a budget for a specific category and month",
        {
            input: z.object({
                start_date: z
                    .string()
                    .describe("Budget month start date in YYYY-MM-DD format"),
                category_id: z
                    .number()
                    .describe("Category ID for the budget to remove"),
            }),
        },
        async ({ input }) => {
            const { baseUrl, lunchmoneyApiToken } = getConfig();
    
            const params = new URLSearchParams({
                start_date: input.start_date,
                category_id: input.category_id.toString(),
            });
    
            const response = await fetch(`${baseUrl}/budgets?${params}`, {
                method: "DELETE",
                headers: {
                    Authorization: `Bearer ${lunchmoneyApiToken}`,
                },
            });
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to remove budget: ${response.statusText}`,
                        },
                    ],
                };
            }
    
            return {
                content: [
                    {
                        type: "text",
                        text: "Budget removed successfully",
                    },
                ],
            };
        }
    );

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