Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

unsplit_transactions

Remove transactions from split groups in LunchMoney, optionally deleting parent transactions to simplify financial record management.

Instructions

Remove one or more transactions from a split

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • The handler function for the unsplit_transactions tool. It makes a POST request to the LunchMoney API endpoint `/transactions/unsplit` with the provided parent_ids and optional remove_parents flag, returning the API response or an error message.
    async ({ input }) => {
        const { baseUrl, lunchmoneyApiToken } = getConfig();
    
        const response = await fetch(`${baseUrl}/transactions/unsplit`, {
            method: "POST",
            headers: {
                Authorization: `Bearer ${lunchmoneyApiToken}`,
                "Content-Type": "application/json",
            },
            body: JSON.stringify({
                parent_ids: input.parent_ids,
                remove_parents: input.remove_parents,
            }),
        });
    
        if (!response.ok) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Failed to unsplit transactions: ${response.statusText}`,
                    },
                ],
            };
        }
    
        const result = await response.json();
    
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(result),
                },
            ],
        };
    }
  • Zod schema defining the input parameters for the unsplit_transactions tool: an array of parent transaction IDs (required) and an optional boolean to remove parents.
    {
        input: z.object({
            parent_ids: z
                .array(z.number())
                .describe("Array of parent transaction IDs to unsplit"),
            remove_parents: z
                .boolean()
                .optional()
                .describe("If true, delete parent transactions"),
        }),
    },
  • The server.tool call that registers the unsplit_transactions tool, including its description, input schema, and handler function.
    server.tool(
        "unsplit_transactions",
        "Remove one or more transactions from a split",
        {
            input: z.object({
                parent_ids: z
                    .array(z.number())
                    .describe("Array of parent transaction IDs to unsplit"),
                remove_parents: z
                    .boolean()
                    .optional()
                    .describe("If true, delete parent transactions"),
            }),
        },
        async ({ input }) => {
            const { baseUrl, lunchmoneyApiToken } = getConfig();
    
            const response = await fetch(`${baseUrl}/transactions/unsplit`, {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${lunchmoneyApiToken}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify({
                    parent_ids: input.parent_ids,
                    remove_parents: input.remove_parents,
                }),
            });
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to unsplit transactions: ${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