create_transaction_group
Group multiple transactions together in LunchMoney to organize related financial entries under a single payee, date, and category for better tracking.
Instructions
Create a transaction group
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes |
Implementation Reference
- src/tools/transactions.ts:550-583 (handler)The async handler function that executes the tool logic: sends a POST request to the Lunchmoney API /transactions/group endpoint with the provided input to create a transaction group.async ({ input }) => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/transactions/group`, { method: "POST", headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, "Content-Type": "application/json", }, body: JSON.stringify(input), }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to create transaction group: ${response.statusText}`, }, ], }; } const result = await response.json(); return { content: [ { type: "text", text: JSON.stringify(result), }, ], }; }
- src/tools/transactions.ts:533-548 (schema)Zod input schema defining parameters for the create_transaction_group tool: required date, payee, transaction_ids; optional category_id, notes, tags.input: z.object({ date: z.string().describe("Date in YYYY-MM-DD format"), payee: z.string().describe("Payee name for the group"), category_id: z .number() .optional() .describe("Category ID for the group"), notes: z.string().optional().describe("Notes for the group"), tags: z .array(z.number()) .optional() .describe("Array of tag IDs for the group"), transaction_ids: z .array(z.number()) .describe("Array of transaction IDs to group"), }),
- src/tools/transactions.ts:529-584 (registration)Registration of the create_transaction_group tool via server.tool() within the registerTransactionTools function, specifying name, description, input schema, and inline handler.server.tool( "create_transaction_group", "Create a transaction group", { input: z.object({ date: z.string().describe("Date in YYYY-MM-DD format"), payee: z.string().describe("Payee name for the group"), category_id: z .number() .optional() .describe("Category ID for the group"), notes: z.string().optional().describe("Notes for the group"), tags: z .array(z.number()) .optional() .describe("Array of tag IDs for the group"), transaction_ids: z .array(z.number()) .describe("Array of transaction IDs to group"), }), }, async ({ input }) => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/transactions/group`, { method: "POST", headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, "Content-Type": "application/json", }, body: JSON.stringify(input), }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to create transaction group: ${response.statusText}`, }, ], }; } const result = await response.json(); return { content: [ { type: "text", text: JSON.stringify(result), }, ], }; } );