Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

get_single_transaction

Retrieve detailed information about a specific transaction from LunchMoney using its unique ID, including amount, date, and category data.

Instructions

Get details of a specific transaction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • Handler function that retrieves a single transaction by ID from the LunchMoney API, handles optional debit_as_negative parameter, and returns the transaction as JSON text.
        const { baseUrl, lunchmoneyApiToken } = getConfig();
    
        const params = new URLSearchParams();
        if (input.debit_as_negative !== undefined) {
            params.append(
                "debit_as_negative",
                input.debit_as_negative.toString()
            );
        }
    
        const url = params.toString()
            ? `${baseUrl}/transactions/${input.transaction_id}?${params}`
            : `${baseUrl}/transactions/${input.transaction_id}`;
    
        const response = await fetch(url, {
            headers: {
                Authorization: `Bearer ${lunchmoneyApiToken}`,
            },
        });
    
        if (!response.ok) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Failed to get transaction: ${response.statusText}`,
                    },
                ],
            };
        }
    
        const transaction: Transaction = await response.json();
    
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(transaction),
                },
            ],
        };
    }
  • Input schema using Zod for validating transaction_id (required number) and optional debit_as_negative (boolean). Defines the tool's input parameters.
    {
        input: z.object({
            transaction_id: z
                .number()
                .describe("ID of the transaction to retrieve"),
            debit_as_negative: z
                .boolean()
                .optional()
                .describe("Pass true to return debit amounts as negative"),
        }),
    },
  • Registration of the 'get_single_transaction' tool on the MCP server within the registerTransactionTools function, including name, description, schema, and handler.
    server.tool(
        "get_single_transaction",
        "Get details of a specific transaction",
        {
            input: z.object({
                transaction_id: z
                    .number()
                    .describe("ID of the transaction to retrieve"),
                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();
            if (input.debit_as_negative !== undefined) {
                params.append(
                    "debit_as_negative",
                    input.debit_as_negative.toString()
                );
            }
    
            const url = params.toString()
                ? `${baseUrl}/transactions/${input.transaction_id}?${params}`
                : `${baseUrl}/transactions/${input.transaction_id}`;
    
            const response = await fetch(url, {
                headers: {
                    Authorization: `Bearer ${lunchmoneyApiToken}`,
                },
            });
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to get transaction: ${response.statusText}`,
                        },
                    ],
                };
            }
    
            const transaction: Transaction = await response.json();
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(transaction),
                    },
                ],
            };
        }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It implies a read-only operation ('Get'), but doesn't disclose error handling (e.g., invalid ID), authentication needs, rate limits, or response format. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 with zero wasted words. It's front-loaded with the core purpose and appropriately sized for a simple retrieval tool. Every word earns its place without being overly terse.

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 lack of annotations and output schema, the description is insufficiently complete. It doesn't explain what details are returned, error conditions, or how parameters affect behavior. For a tool with no structured metadata, the description should provide more contextual information to guide effective use.

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?

The description mentions retrieving a 'specific transaction', which implicitly relates to the 'transaction_id' parameter. With 0% schema description coverage, this adds meaningful context beyond the bare schema. However, it doesn't address the 'debit_as_negative' parameter or provide deeper semantic insights, keeping it from a perfect score.

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 verb ('Get') and resource ('details of a specific transaction'), making the purpose unambiguous. It distinguishes from siblings like 'get_transactions' (plural) and 'get_transaction_group' by specifying retrieval of a single transaction. However, it doesn't explicitly mention what details are included, 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 like 'get_transactions' or 'get_transaction_group'. It doesn't mention prerequisites (e.g., needing a valid transaction ID) or exclusions. The agent must infer usage solely from the tool name and sibling context.

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