Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

split_transaction

Split a transaction into 2-500 child transactions; the sum of child amounts must equal the parent's. After splitting, the parent is hidden from default transaction views.

Instructions

Split an existing transaction into 2-500 child transactions. The sum of child amounts must equal the parent's amount. After splitting, the parent is hidden from get_transactions and accessible via get_single_transaction (returns the parent with children).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
transaction_idYesID of the transaction to split.
child_transactionsYesChildren to create. Sum of amounts must equal the parent's amount.

Implementation Reference

  • Handler for split_transaction tool: calls POST /transactions/split/{id} with child_transactions array. Returns the API response data on success.
    async ({ transaction_id, child_transactions }) => {
        try {
            const response = await api.post(
                `/transactions/split/${transaction_id}`,
                { child_transactions },
            );
    
            if (!response.ok) {
                return handleApiError(
                    response,
                    "Failed to split transaction",
                );
            }
    
            return dataResponse(await response.json());
        } catch (error) {
            return catchError(error, "Failed to split transaction");
        }
    },
  • Registration of split_transaction tool on the MCP server, with description, input schema, and annotations.
    server.registerTool(
        "split_transaction",
        {
            description:
                "Split an existing transaction into 2-500 child transactions. The sum of child amounts must equal the parent's amount. After splitting, the parent is hidden from get_transactions and accessible via get_single_transaction (returns the parent with `children`).",
            inputSchema: {
                transaction_id: z.coerce
                    .number()
                    .describe("ID of the transaction to split."),
                child_transactions: z
                    .array(splitChildSchema)
                    .min(2)
                    .max(500)
                    .describe(
                        "Children to create. Sum of amounts must equal the parent's amount.",
                    ),
            },
            annotations: {
                idempotentHint: false,
            },
        },
        async ({ transaction_id, child_transactions }) => {
            try {
                const response = await api.post(
                    `/transactions/split/${transaction_id}`,
                    { child_transactions },
                );
    
                if (!response.ok) {
                    return handleApiError(
                        response,
                        "Failed to split transaction",
                    );
                }
    
                return dataResponse(await response.json());
            } catch (error) {
                return catchError(error, "Failed to split transaction");
            }
        },
    );
  • Zod schema for each child transaction in the split, defining amount (required), payee, date, category_id, tag_ids, and notes (all optional except amount).
    const splitChildSchema = z.object({
        amount: z.coerce
            .number()
            .describe(
                "Amount of this split. Sum of all children must equal the parent's amount.",
            ),
        payee: z
            .string()
            .max(140)
            .optional()
            .describe("Defaults to the parent's payee."),
        date: z
            .string()
            .regex(/^\d{4}-\d{2}-\d{2}$/, "Must be YYYY-MM-DD format")
            .optional()
            .describe("Defaults to the parent's date."),
        category_id: z.coerce
            .number()
            .optional()
            .describe(
                "Category ID. Defaults to parent's category. Cannot be a category group.",
            ),
        tag_ids: z.array(z.coerce.number()).optional(),
        notes: z
            .string()
            .max(350)
            .optional()
            .describe("Defaults to the parent's notes."),
    });
  • API helper object providing post method used by split_transaction handler (calls POST /transactions/split/{id}).
    export const api = {
        get: (path: string) => apiRequest("GET", path),
        post: (path: string, body?: unknown) => apiRequest("POST", path, body),
        put: (path: string, body: unknown) => apiRequest("PUT", path, body),
        delete: (path: string, body?: unknown) => apiRequest("DELETE", path, body),
        upload: (path: string, formData: FormData) =>
            apiUpload("POST", path, formData),
    };
Behavior5/5

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

Beyond the minimal annotation (idempotentHint: false), the description discloses key behavioral traits: the sum constraint, the parent hiding from get_transactions, and accessibility via get_single_transaction with children. This fully informs the agent of side effects.

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?

Two compact sentences, each adding essential information. No redundant text. Front-loaded with the action and key constraint.

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

Completeness4/5

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

Given no output schema, the description explains the effect on parent visibility and access. It covers the range constraint and sum requirement. Missing mention of the sibling unsplit_transaction for reversal, but still fairly complete for a mutation tool.

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

Parameters4/5

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

Input schema coverage is 100%, so baseline is 3. The description adds crucial context like the sum constraint and parent hiding, which goes beyond the schema's field descriptions. However, it doesn't elaborate on individual parameter defaults beyond what's in the schema.

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 tool splits an existing transaction into 2-500 child transactions, with a specific verb ('split') and resource ('existing transaction'). It distinguishes from siblings like unsplit_transaction and create_transactions by detailing the parent hiding behavior.

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 the tool (to split a transaction) and the consequences (parent hidden from listing). It doesn't explicitly state when not to use it, but the context is clear for an AI agent.

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