Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

create_transactions

Insert one or more financial transactions into LunchMoney with details like date, payee, amount, currency, category, and status for expense tracking.

Instructions

Insert one or more transactions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • The handler function that implements the create_transactions tool by sending a POST request to the LunchMoney API to insert transactions.
        async ({ input }) => {
            const { baseUrl, lunchmoneyApiToken } = getConfig();
    
            const body: any = {
                transactions: input.transactions,
            };
    
            if (input.apply_rules !== undefined)
                body.apply_rules = input.apply_rules;
            if (input.skip_duplicates !== undefined)
                body.skip_duplicates = input.skip_duplicates;
            if (input.check_for_recurring !== undefined)
                body.check_for_recurring = input.check_for_recurring;
            if (input.debit_as_negative !== undefined)
                body.debit_as_negative = input.debit_as_negative;
            if (input.skip_balance_update !== undefined)
                body.skip_balance_update = input.skip_balance_update;
    
            const response = await fetch(`${baseUrl}/transactions`, {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${lunchmoneyApiToken}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify(body),
            });
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to create transactions: ${response.statusText}`,
                        },
                    ],
                };
            }
    
            const result = await response.json();
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(result),
                    },
                ],
            };
        }
    );
  • The Zod input schema defining the parameters for creating transactions, including the array of transactions and optional flags.
        transactions: z
            .array(
                z.object({
                    date: z
                        .string()
                        .describe("Date in YYYY-MM-DD format"),
                    payee: z.string().describe("Payee name"),
                    amount: z
                        .string()
                        .describe(
                            "Amount as string with up to 4 decimal places"
                        ),
                    currency: z
                        .string()
                        .optional()
                        .describe(
                            "Three-letter lowercase currency code"
                        ),
                    category_id: z
                        .number()
                        .optional()
                        .describe("Category ID"),
                    asset_id: z
                        .number()
                        .optional()
                        .describe("Asset ID for manual accounts"),
                    recurring_id: z
                        .number()
                        .optional()
                        .describe("Recurring expense ID"),
                    notes: z
                        .string()
                        .optional()
                        .describe("Transaction notes"),
                    status: z
                        .enum(["cleared", "uncleared", "pending"])
                        .optional()
                        .describe("Transaction status"),
                    external_id: z
                        .string()
                        .optional()
                        .describe("External ID (max 75 characters)"),
                    tags: z
                        .array(z.number())
                        .optional()
                        .describe("Array of tag IDs"),
                })
            )
            .describe("Array of transactions to create"),
        apply_rules: z
            .boolean()
            .optional()
            .describe("Apply account's rules to transactions"),
        skip_duplicates: z
            .boolean()
            .optional()
            .describe(
                "Skip transactions that are potential duplicates"
            ),
        check_for_recurring: z
            .boolean()
            .optional()
            .describe(
                "Check if transactions are part of recurring expenses"
            ),
        debit_as_negative: z
            .boolean()
            .optional()
            .describe(
                "Pass true if debits are provided as negative amounts"
            ),
        skip_balance_update: z
            .boolean()
            .optional()
            .describe("Skip updating balance for assets/accounts"),
    }),
  • The registration of the create_transactions tool using server.tool(), including name, description, schema, and handler.
    server.tool(
        "create_transactions",
        "Insert one or more transactions",
        {
            input: z.object({
                transactions: z
                    .array(
                        z.object({
                            date: z
                                .string()
                                .describe("Date in YYYY-MM-DD format"),
                            payee: z.string().describe("Payee name"),
                            amount: z
                                .string()
                                .describe(
                                    "Amount as string with up to 4 decimal places"
                                ),
                            currency: z
                                .string()
                                .optional()
                                .describe(
                                    "Three-letter lowercase currency code"
                                ),
                            category_id: z
                                .number()
                                .optional()
                                .describe("Category ID"),
                            asset_id: z
                                .number()
                                .optional()
                                .describe("Asset ID for manual accounts"),
                            recurring_id: z
                                .number()
                                .optional()
                                .describe("Recurring expense ID"),
                            notes: z
                                .string()
                                .optional()
                                .describe("Transaction notes"),
                            status: z
                                .enum(["cleared", "uncleared", "pending"])
                                .optional()
                                .describe("Transaction status"),
                            external_id: z
                                .string()
                                .optional()
                                .describe("External ID (max 75 characters)"),
                            tags: z
                                .array(z.number())
                                .optional()
                                .describe("Array of tag IDs"),
                        })
                    )
                    .describe("Array of transactions to create"),
                apply_rules: z
                    .boolean()
                    .optional()
                    .describe("Apply account's rules to transactions"),
                skip_duplicates: z
                    .boolean()
                    .optional()
                    .describe(
                        "Skip transactions that are potential duplicates"
                    ),
                check_for_recurring: z
                    .boolean()
                    .optional()
                    .describe(
                        "Check if transactions are part of recurring expenses"
                    ),
                debit_as_negative: z
                    .boolean()
                    .optional()
                    .describe(
                        "Pass true if debits are provided as negative amounts"
                    ),
                skip_balance_update: z
                    .boolean()
                    .optional()
                    .describe("Skip updating balance for assets/accounts"),
            }),
        },
        async ({ input }) => {
            const { baseUrl, lunchmoneyApiToken } = getConfig();
    
            const body: any = {
                transactions: input.transactions,
            };
    
            if (input.apply_rules !== undefined)
                body.apply_rules = input.apply_rules;
            if (input.skip_duplicates !== undefined)
                body.skip_duplicates = input.skip_duplicates;
            if (input.check_for_recurring !== undefined)
                body.check_for_recurring = input.check_for_recurring;
            if (input.debit_as_negative !== undefined)
                body.debit_as_negative = input.debit_as_negative;
            if (input.skip_balance_update !== undefined)
                body.skip_balance_update = input.skip_balance_update;
    
            const response = await fetch(`${baseUrl}/transactions`, {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${lunchmoneyApiToken}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify(body),
            });
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to create transactions: ${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. 'Insert' implies a write operation, but the description doesn't address permissions needed, whether this is idempotent, what happens on partial failures, or what the response looks like. For a mutation tool with zero annotation coverage, this is insufficient behavioral context.

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 maximally concise with a single clear sentence that states the core functionality. There's no wasted language or unnecessary elaboration, making it easy to parse and understand at a glance.

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

Completeness1/5

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

For a complex mutation tool with no annotations, no output schema, and a highly nested parameter structure, the description is completely inadequate. It doesn't explain what constitutes a valid transaction, how to handle errors, what the response contains, or any behavioral characteristics beyond the basic action.

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

Parameters1/5

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

The description provides zero information about parameters, while the schema has 0% description coverage (parameter names only, no descriptions). With 1 top-level parameter containing 6 nested parameters and an array of transaction objects with 11 properties, this represents a complete documentation gap that the description fails to address.

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 action ('Insert') and resource ('one or more transactions'), making the purpose immediately understandable. It doesn't distinguish from siblings like 'create_transaction_group' or 'update_transaction', but the verb+resource combination is specific enough for basic understanding.

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 about when to use this tool versus alternatives like 'create_transaction_group' or 'update_transaction'. The description doesn't mention prerequisites, constraints, or typical use cases, leaving the agent with no contextual guidance for tool selection.

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