unsplit_transactions
Remove transactions from split groups in LunchMoney, optionally deleting parent transactions to simplify financial record management.
Instructions
Remove one or more transactions from a split
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes |
Implementation Reference
- src/tools/transactions.ts:444-480 (handler)The handler function for the unsplit_transactions tool. It makes a POST request to the LunchMoney API endpoint `/transactions/unsplit` with the provided parent_ids and optional remove_parents flag, returning the API response or an error message.async ({ input }) => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/transactions/unsplit`, { method: "POST", headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, "Content-Type": "application/json", }, body: JSON.stringify({ parent_ids: input.parent_ids, remove_parents: input.remove_parents, }), }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to unsplit transactions: ${response.statusText}`, }, ], }; } const result = await response.json(); return { content: [ { type: "text", text: JSON.stringify(result), }, ], }; }
- src/tools/transactions.ts:433-443 (schema)Zod schema defining the input parameters for the unsplit_transactions tool: an array of parent transaction IDs (required) and an optional boolean to remove parents.{ input: z.object({ parent_ids: z .array(z.number()) .describe("Array of parent transaction IDs to unsplit"), remove_parents: z .boolean() .optional() .describe("If true, delete parent transactions"), }), },
- src/tools/transactions.ts:430-481 (registration)The server.tool call that registers the unsplit_transactions tool, including its description, input schema, and handler function.server.tool( "unsplit_transactions", "Remove one or more transactions from a split", { input: z.object({ parent_ids: z .array(z.number()) .describe("Array of parent transaction IDs to unsplit"), remove_parents: z .boolean() .optional() .describe("If true, delete parent transactions"), }), }, async ({ input }) => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/transactions/unsplit`, { method: "POST", headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, "Content-Type": "application/json", }, body: JSON.stringify({ parent_ids: input.parent_ids, remove_parents: input.remove_parents, }), }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to unsplit transactions: ${response.statusText}`, }, ], }; } const result = await response.json(); return { content: [ { type: "text", text: JSON.stringify(result), }, ], }; } );