Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

get_transactions

Retrieve financial transactions from LunchMoney within specified date ranges using filters for tags, categories, accounts, and status to analyze spending patterns.

Instructions

Retrieve transactions within a date range with optional filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • Handler function that constructs API parameters from input, fetches transactions from Lunchmoney API, and returns JSON response.
        async ({ input }) => {
            const { baseUrl, lunchmoneyApiToken } = getConfig();
    
            const params = new URLSearchParams({
                start_date: input.start_date,
                end_date: input.end_date,
            });
    
            if (input.tag_id !== undefined)
                params.append("tag_id", input.tag_id.toString());
            if (input.recurring_id !== undefined)
                params.append("recurring_id", input.recurring_id.toString());
            if (input.plaid_account_id !== undefined)
                params.append(
                    "plaid_account_id",
                    input.plaid_account_id.toString()
                );
            if (input.category_id !== undefined)
                params.append("category_id", input.category_id.toString());
            if (input.asset_id !== undefined)
                params.append("asset_id", input.asset_id.toString());
            if (input.is_group !== undefined)
                params.append("is_group", input.is_group.toString());
            if (input.status !== undefined)
                params.append("status", input.status);
            if (input.offset !== undefined)
                params.append("offset", input.offset.toString());
            if (input.limit !== undefined)
                params.append("limit", input.limit.toString());
            if (input.debit_as_negative !== undefined)
                params.append(
                    "debit_as_negative",
                    input.debit_as_negative.toString()
                );
    
            const response = await fetch(`${baseUrl}/transactions?${params}`, {
                headers: {
                    Authorization: `Bearer ${lunchmoneyApiToken}`,
                },
            });
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to get transactions: ${response.statusText}`,
                        },
                    ],
                };
            }
    
            const data = await response.json();
            const transactions: Transaction[] = data.transactions;
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify({
                            transactions,
                            has_more: data.has_more,
                        }),
                    },
                ],
            };
        }
    );
  • Zod input schema defining parameters for filtering and paginating transactions.
    input: z.object({
        start_date: z
            .string()
            .describe("Start date in YYYY-MM-DD format"),
        end_date: z.string().describe("End date in YYYY-MM-DD format"),
        tag_id: z.number().optional().describe("Filter by tag ID"),
        recurring_id: z
            .number()
            .optional()
            .describe("Filter by recurring expense ID"),
        plaid_account_id: z
            .number()
            .optional()
            .describe("Filter by Plaid account ID"),
        category_id: z
            .number()
            .optional()
            .describe("Filter by category ID"),
        asset_id: z.number().optional().describe("Filter by asset ID"),
        is_group: z
            .boolean()
            .optional()
            .describe("Filter by transaction groups"),
        status: z
            .string()
            .optional()
            .describe("Filter by status: cleared, uncleared, pending"),
        offset: z
            .number()
            .optional()
            .describe("Number of transactions to skip"),
        limit: z
            .number()
            .optional()
            .describe(
                "Maximum number of transactions to return (max 500)"
            ),
        debit_as_negative: z
            .boolean()
            .optional()
            .describe("Pass true to return debit amounts as negative"),
    }),
  • Registration of the get_transactions tool using server.tool, including name, description, schema, and handler.
    server.tool(
        "get_transactions",
        "Retrieve transactions within a date range with optional filters",
        {
            input: z.object({
                start_date: z
                    .string()
                    .describe("Start date in YYYY-MM-DD format"),
                end_date: z.string().describe("End date in YYYY-MM-DD format"),
                tag_id: z.number().optional().describe("Filter by tag ID"),
                recurring_id: z
                    .number()
                    .optional()
                    .describe("Filter by recurring expense ID"),
                plaid_account_id: z
                    .number()
                    .optional()
                    .describe("Filter by Plaid account ID"),
                category_id: z
                    .number()
                    .optional()
                    .describe("Filter by category ID"),
                asset_id: z.number().optional().describe("Filter by asset ID"),
                is_group: z
                    .boolean()
                    .optional()
                    .describe("Filter by transaction groups"),
                status: z
                    .string()
                    .optional()
                    .describe("Filter by status: cleared, uncleared, pending"),
                offset: z
                    .number()
                    .optional()
                    .describe("Number of transactions to skip"),
                limit: z
                    .number()
                    .optional()
                    .describe(
                        "Maximum number of transactions to return (max 500)"
                    ),
                debit_as_negative: z
                    .boolean()
                    .optional()
                    .describe("Pass true to return debit amounts as negative"),
            }),
        },
        async ({ input }) => {
            const { baseUrl, lunchmoneyApiToken } = getConfig();
    
            const params = new URLSearchParams({
                start_date: input.start_date,
                end_date: input.end_date,
            });
    
            if (input.tag_id !== undefined)
                params.append("tag_id", input.tag_id.toString());
            if (input.recurring_id !== undefined)
                params.append("recurring_id", input.recurring_id.toString());
            if (input.plaid_account_id !== undefined)
                params.append(
                    "plaid_account_id",
                    input.plaid_account_id.toString()
                );
            if (input.category_id !== undefined)
                params.append("category_id", input.category_id.toString());
            if (input.asset_id !== undefined)
                params.append("asset_id", input.asset_id.toString());
            if (input.is_group !== undefined)
                params.append("is_group", input.is_group.toString());
            if (input.status !== undefined)
                params.append("status", input.status);
            if (input.offset !== undefined)
                params.append("offset", input.offset.toString());
            if (input.limit !== undefined)
                params.append("limit", input.limit.toString());
            if (input.debit_as_negative !== undefined)
                params.append(
                    "debit_as_negative",
                    input.debit_as_negative.toString()
                );
    
            const response = await fetch(`${baseUrl}/transactions?${params}`, {
                headers: {
                    Authorization: `Bearer ${lunchmoneyApiToken}`,
                },
            });
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to get transactions: ${response.statusText}`,
                        },
                    ],
                };
            }
    
            const data = await response.json();
            const transactions: Transaction[] = data.transactions;
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify({
                            transactions,
                            has_more: data.has_more,
                        }),
                    },
                ],
            };
        }
    );
  • src/index.ts:26-26 (registration)
    Top-level call to registerTransactionTools which includes the get_transactions tool.
    registerTransactionTools(server);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves transactions but fails to mention critical behaviors such as pagination handling (implied by 'limit' and 'offset' in schema but not described), rate limits, authentication requirements, or error conditions. For a tool with many parameters and no annotation support, this is a significant gap in transparency.

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 functionality ('Retrieve transactions within a date range with optional filters'). It avoids redundancy and waste, making it easy to parse quickly. Every word contributes to understanding the tool's basic purpose without unnecessary elaboration.

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?

Given the tool's complexity (12 parameters, no annotations, no output schema), the description is insufficient. It omits details on parameter usage, behavioral traits like pagination or errors, and output format. While concise, it doesn't provide enough context for an AI agent to invoke the tool effectively, especially with high parameter count and no structured support.

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 schema description coverage is 0%, meaning all parameters are undocumented in the schema. The description only vaguely mentions 'optional filters' without explaining any parameters, their purposes, or how they interact. It adds no meaningful semantic information beyond what the schema's property names imply, failing to compensate for the lack of schema descriptions.

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 tool's purpose: 'Retrieve transactions within a date range with optional filters.' It specifies the verb ('retrieve'), resource ('transactions'), and scope ('date range with optional filters'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_single_transaction' or 'get_transaction_group,' which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'optional filters' but doesn't specify scenarios where this is preferred over sibling tools like 'get_single_transaction' or 'get_transaction_group,' nor does it outline prerequisites or exclusions. This lack of contextual direction limits its utility 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