feat: add delete-credit-note-allocation tool (+ show allocations in list-credit-notes)#194
Open
rathga wants to merge 1 commit into
Open
feat: add delete-credit-note-allocation tool (+ show allocations in list-credit-notes)#194rathga wants to merge 1 commit into
rathga wants to merge 1 commit into
Conversation
…in list-credit-notes Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
delete-credit-note-allocationtool wrappingAccountingApi.deleteCreditNoteAllocations, and extendslist-credit-notesoutput with each credit note's allocations (allocation ID, amount, date, target invoice) and remaining credit so allocation IDs are discoverable.Why
create-credit-note-allocationcan apply credit to an invoice, but there is currently no way to undo an allocation made in error — or to free up an allocated credit note so it can be corrected and re-applied. The common bookkeeping flow "de-allocate → fix → re-allocate" is impossible via the MCP today. Notably, once a credit note is fully allocated Xero flips its status to PAID, so nothing about it can be changed until the allocation is removed.list-credit-notespreviously didn't show allocations at all, so even with a delete tool there was no way to obtain an allocation ID; this PR surfaces them in the existing list output.Changes
src/handlers/delete-xero-credit-note-allocation.handler.ts— thin wrapper arounddeleteCreditNoteAllocations(tenantId, creditNoteID, allocationID)src/tools/delete/delete-credit-note-allocation.tool.ts— MCP tool (creditNoteId,allocationId)src/tools/delete/index.ts— register the toolsrc/tools/list/list-credit-notes.tool.ts— include remaining credit + allocations (with IDs) per credit noteTesting
npm run build,npm run lint,npm testall passlist-credit-notes, deleted the allocation via the new tool, and confirmed the allocation disappeared and the credit note's remaining credit returned to the full amount (status PAID → AUTHORISED). All fixtures voided/archived afterwards.🤖 Generated with Claude Code