Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

get_transaction_group

Retrieve detailed information about a specific transaction group in LunchMoney by providing the transaction group ID to access financial data.

Instructions

Get details of a transaction group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • Registration of the 'get_transaction_group' tool using server.tool(), including schema definition and handler implementation. Fetches transaction group details from LunchMoney API endpoint /transactions/group/{id}.
    server.tool(
        "get_transaction_group",
        "Get details of a transaction group",
        {
            input: z.object({
                transaction_id: z
                    .number()
                    .describe("ID of the transaction group"),
            }),
        },
        async ({ input }) => {
            const { baseUrl, lunchmoneyApiToken } = getConfig();
    
            const response = await fetch(
                `${baseUrl}/transactions/group/${input.transaction_id}`,
                {
                    headers: {
                        Authorization: `Bearer ${lunchmoneyApiToken}`,
                    },
                }
            );
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to get transaction group: ${response.statusText}`,
                        },
                    ],
                };
            }
    
            const result = await response.json();
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(result),
                    },
                ],
            };
        }
    );
  • Handler function that makes an authenticated GET request to the LunchMoney API to retrieve details of a specific transaction group by ID and returns the JSON result.
        async ({ input }) => {
            const { baseUrl, lunchmoneyApiToken } = getConfig();
    
            const response = await fetch(
                `${baseUrl}/transactions/group/${input.transaction_id}`,
                {
                    headers: {
                        Authorization: `Bearer ${lunchmoneyApiToken}`,
                    },
                }
            );
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to get transaction group: ${response.statusText}`,
                        },
                    ],
                };
            }
    
            const result = await response.json();
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(result),
                    },
                ],
            };
        }
    );
  • Zod input schema requiring a numeric transaction_id for the transaction group.
    input: z.object({
        transaction_id: z
            .number()
            .describe("ID of the transaction group"),
    }),

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