Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

create_transaction_group

Group multiple transactions together in LunchMoney to organize related financial entries under a single payee, date, and category for better tracking.

Instructions

Create a transaction group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • The async handler function that executes the tool logic: sends a POST request to the Lunchmoney API /transactions/group endpoint with the provided input to create a transaction group.
    async ({ input }) => {
        const { baseUrl, lunchmoneyApiToken } = getConfig();
    
        const response = await fetch(`${baseUrl}/transactions/group`, {
            method: "POST",
            headers: {
                Authorization: `Bearer ${lunchmoneyApiToken}`,
                "Content-Type": "application/json",
            },
            body: JSON.stringify(input),
        });
    
        if (!response.ok) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Failed to create transaction group: ${response.statusText}`,
                    },
                ],
            };
        }
    
        const result = await response.json();
    
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(result),
                },
            ],
        };
    }
  • Zod input schema defining parameters for the create_transaction_group tool: required date, payee, transaction_ids; optional category_id, notes, tags.
    input: z.object({
        date: z.string().describe("Date in YYYY-MM-DD format"),
        payee: z.string().describe("Payee name for the group"),
        category_id: z
            .number()
            .optional()
            .describe("Category ID for the group"),
        notes: z.string().optional().describe("Notes for the group"),
        tags: z
            .array(z.number())
            .optional()
            .describe("Array of tag IDs for the group"),
        transaction_ids: z
            .array(z.number())
            .describe("Array of transaction IDs to group"),
    }),
  • Registration of the create_transaction_group tool via server.tool() within the registerTransactionTools function, specifying name, description, input schema, and inline handler.
    server.tool(
        "create_transaction_group",
        "Create a transaction group",
        {
            input: z.object({
                date: z.string().describe("Date in YYYY-MM-DD format"),
                payee: z.string().describe("Payee name for the group"),
                category_id: z
                    .number()
                    .optional()
                    .describe("Category ID for the group"),
                notes: z.string().optional().describe("Notes for the group"),
                tags: z
                    .array(z.number())
                    .optional()
                    .describe("Array of tag IDs for the group"),
                transaction_ids: z
                    .array(z.number())
                    .describe("Array of transaction IDs to group"),
            }),
        },
        async ({ input }) => {
            const { baseUrl, lunchmoneyApiToken } = getConfig();
    
            const response = await fetch(`${baseUrl}/transactions/group`, {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${lunchmoneyApiToken}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify(input),
            });
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to create transaction group: ${response.statusText}`,
                        },
                    ],
                };
            }
    
            const result = await response.json();
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(result),
                    },
                ],
            };
        }
    );

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