Skip to main content
Glama
leafeye

lunchmoney-mcp

get-recent-transactions

Retrieve recent financial transactions from Lunch Money to analyze spending patterns, track expenses, and monitor account activity over a specified period.

Instructions

Get recent transactions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNoNumber of days to look back
limitNoMaximum number of transactions to return

Implementation Reference

  • src/index.ts:144-172 (registration)
    Registration of the 'get-recent-transactions' tool using McpServer.tool(), including description, input schema, and inline handler function.
    this.server.tool(
        "get-recent-transactions",
        "Get recent transactions",
        {
            days: z.number().default(30).describe("Number of days to look back"),
            limit: z.number().default(10).describe("Maximum number of transactions to return"),
        },
        async ({ days, limit }) => {
            const endDate = new Date().toISOString().split('T')[0];
            const startDate = new Date(Date.now() - days * 24 * 60 * 60 * 1000)
                .toISOString()
                .split('T')[0];
    
            const transactions = await this.fetchTransactions({
                start_date: startDate,
                end_date: endDate,
                limit,
            });
    
            return {
                content: [
                    {
                        type: "text",
                        text: this.formatTransactions(transactions),
                    },
                ],
            };
        },
    );
  • The main handler function for the tool, which calculates date range, fetches transactions using helper, formats them, and returns as text content.
    async ({ days, limit }) => {
        const endDate = new Date().toISOString().split('T')[0];
        const startDate = new Date(Date.now() - days * 24 * 60 * 60 * 1000)
            .toISOString()
            .split('T')[0];
    
        const transactions = await this.fetchTransactions({
            start_date: startDate,
            end_date: endDate,
            limit,
        });
    
        return {
            content: [
                {
                    type: "text",
                    text: this.formatTransactions(transactions),
                },
            ],
        };
  • Zod schema defining input parameters: days (default 30) and limit (default 10).
    {
        days: z.number().default(30).describe("Number of days to look back"),
        limit: z.number().default(10).describe("Maximum number of transactions to return"),
    },
  • Helper method to fetch transactions from Lunchmoney API using the provided parameters, handles query params, auth, and error checking.
    private async fetchTransactions(params: Record<string, any>): Promise<Transaction[]> {
        const queryParams = new URLSearchParams();
        for (const [key, value] of Object.entries(params)) {
            queryParams.append(key, value.toString());
        }
    
        const response = await fetch(`${API_BASE}/transactions?${queryParams}`, {
            headers: {
                Authorization: `Bearer ${this.token}`,
                Accept: "application/json",
            }
        });
    
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
    
        const data = await response.json() as TransactionResponse;
        return data.transactions || [];
    }
  • Helper method to format a list of transactions into a readable text string with key details.
    private formatTransactions(transactions: Transaction[]): string {
        return transactions
            .map(tx => {
                let summary = [
                    `Date: ${tx.date}`,
                    `Amount: ${tx.amount} ${tx.currency.toUpperCase()}`,
                    `Payee: ${tx.payee}`,
                    `Category: ${tx.category_name} (${tx.category_group_name})`,
                    `Account: ${tx.account_display_name || "N/A"}`,
                    `Status: ${tx.status}`,
                ];
    
                if (tx.tags && tx.tags.length > 0) {
                    summary.push(`Tags: ${tx.tags.map((t: Tag) => t.name).join(", ")}`);
                }
    
                if (tx.notes) {
                    summary.push(`Notes: ${tx.notes}`);
                }
    
                return summary.join("\n");
            })
            .join("\n\n---\n\n");
    }
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. 'Get recent transactions' implies a read operation but reveals nothing about permissions, rate limits, pagination, error conditions, or what 'recent' means contextually. For a tool with zero annotation coverage, this leaves critical behavioral traits undocumented.

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 extremely concise at three words with zero wasted text. It's front-loaded and efficiently communicates the core function without unnecessary elaboration. While under-specified, it earns full marks for brevity and structure.

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 moderate complexity (2 parameters, no output schema, no annotations), the description is incomplete. It fails to explain what 'recent' means, how results are ordered, what data fields are returned, or how it differs from sibling tools. The agent lacks sufficient context to use this tool effectively without trial and error.

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

Parameters3/5

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

Schema description coverage is 100%, with both parameters ('days' and 'limit') well-documented in the schema. The description adds no parameter semantics beyond what the schema already provides. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get recent transactions' is a tautology that essentially restates the tool name without adding meaningful differentiation. It specifies the verb 'Get' and resource 'transactions' but lacks specificity about scope or how it differs from sibling tools like 'search-transactions'. This provides minimal value beyond the name itself.

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 like 'search-transactions' or 'get-category-spending'. There's no mention of context, prerequisites, or exclusions. The agent must infer usage from the name alone, which is insufficient for informed 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/leafeye/lunchmoney-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server