Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

upsert_budget

Create or update monthly budget amounts for specific categories in LunchMoney to manage personal finances and track spending against targets.

Instructions

Create or update a budget for a specific category and month

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • The handler function for the 'upsert_budget' tool. It constructs a request body with the budget details and sends a PUT request to the Lunch Money API endpoint `/budgets` to create or update the budget. Returns the API response or an error message.
    async ({ input }) => {
        const { baseUrl, lunchmoneyApiToken } = getConfig();
    
        const body: any = {
            start_date: input.start_date,
            category_id: input.category_id,
            amount: input.amount,
        };
    
        if (input.currency) {
            body.currency = input.currency;
        }
    
        const response = await fetch(`${baseUrl}/budgets`, {
            method: "PUT",
            headers: {
                Authorization: `Bearer ${lunchmoneyApiToken}`,
                "Content-Type": "application/json",
            },
            body: JSON.stringify(body),
        });
    
        if (!response.ok) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Failed to upsert budget: ${response.statusText}`,
                    },
                ],
            };
        }
    
        const result = await response.json();
    
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(result),
                },
            ],
        };
    }
  • Zod schema defining the input parameters for the 'upsert_budget' tool: start_date (string), category_id (number), amount (number), and optional currency (string).
    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"),
        amount: z.number().describe("Budget amount"),
        currency: z
            .string()
            .optional()
            .describe(
                "Currency for budget (defaults to primary currency)"
            ),
    }),
  • Registration of the 'upsert_budget' tool using server.tool(), including name, description, input schema, and handler function.
    server.tool(
        "upsert_budget",
        "Create or update 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"),
                amount: z.number().describe("Budget amount"),
                currency: z
                    .string()
                    .optional()
                    .describe(
                        "Currency for budget (defaults to primary currency)"
                    ),
            }),
        },
        async ({ input }) => {
            const { baseUrl, lunchmoneyApiToken } = getConfig();
    
            const body: any = {
                start_date: input.start_date,
                category_id: input.category_id,
                amount: input.amount,
            };
    
            if (input.currency) {
                body.currency = input.currency;
            }
    
            const response = await fetch(`${baseUrl}/budgets`, {
                method: "PUT",
                headers: {
                    Authorization: `Bearer ${lunchmoneyApiToken}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify(body),
            });
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to upsert budget: ${response.statusText}`,
                        },
                    ],
                };
            }
    
            const result = await response.json();
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(result),
                    },
                ],
            };
        }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool can 'create or update' but doesn't explain the upsert logic (e.g., whether it overwrites existing budgets or merges them), what permissions are required, whether changes are reversible, or what happens on success/failure. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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 purpose. Every word earns its place with no redundancy or unnecessary elaboration. It's appropriately sized for the tool's apparent complexity.

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, 0% schema description coverage, and no output schema, the description is insufficient. It doesn't explain the upsert behavior, error conditions, return values, or how parameters interact. Given the complexity of budget management and the lack of structured documentation, this leaves the agent with inadequate context.

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

Parameters2/5

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

The input schema has 0% description coverage, with all 4 parameters undocumented in the schema. The description mentions 'category and month' which hints at two parameters (category_id and start_date) but doesn't explain the 'amount' or 'currency' parameters. It fails to compensate for the schema's complete lack of parameter documentation, leaving key semantics unclear.

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 ('create or update') and resource ('budget') with specific scope ('for a specific category and month'). It distinguishes from siblings like 'remove_budget' and 'get_budget_summary' by focusing on modification rather than deletion or retrieval. However, it doesn't explicitly differentiate from other budget-related tools beyond the name.

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 guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites like existing categories, when to choose 'create' vs 'update' behavior, or how it relates to sibling tools like 'remove_budget' or 'get_budget_summary'. The agent must infer usage from the name and description alone.

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