feat: add tracking-category/option filtering to list-profit-and-loss (supersedes #161)#186
Open
rathga wants to merge 1 commit into
Open
feat: add tracking-category/option filtering to list-profit-and-loss (supersedes #161)#186rathga wants to merge 1 commit into
rathga wants to merge 1 commit into
Conversation
Add optional trackingCategoryID, trackingOptionID, trackingCategoryID2 and trackingOptionID2 params to the list-profit-and-loss tool, exposing the tracking filters the Xero P&L report endpoint natively supports (per-option breakdown, single-option filter, or cross-tab against a second category). Refactor listXeroProfitAndLoss and the inner fetch to take a single ListProfitAndLossParams object, mirroring the sibling list-report-balance-sheet handler. This removes the fragile positional argument passing and structurally fixes a pre-existing bug: the handler previously called fetchProfitAndLoss with only 5 positional args, so paymentsOnly landed in the standardLayout slot and the real paymentsOnly was dropped (both flags were broken). It also corrects the SDK argument order to categoryID, categoryID2, optionID, optionID2. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
Adds tracking-category/option filtering to the
list-profit-and-losstool, exposing the tracking filters the Xero P&L report endpoint natively supports:trackingCategoryIDalone -> P&L with one column per option in that category (per-option breakdown).trackingCategoryID+trackingOptionID-> P&L filtered to that single option.trackingCategoryID2(+trackingOptionID2) -> cross-tab against a second category (not a second option of the same category).The tool descriptions instruct the agent to obtain IDs from the
list-tracking-categoriestool and explain the breakdown-vs-filter and second-category behaviour.Refactor to a params object
The handler (
listXeroProfitAndLossand its inner fetch) now takes a single typedListProfitAndLossParamsobject instead of positional arguments, mirroring the siblinglist-report-balance-sheethandler /ListReportBalanceSheetParams. This keeps the two report tools consistent and removes the fragile positional argument passing.Supersedes #161 / fixes #138
This supersedes bug-fix PR #161 (issue #138) by fixing the underlying positional-argument bug structurally rather than with a one-line patch. Previously
listXeroProfitAndLosscalledfetchProfitAndLosswith only 5 positional args against a 6-arg signature, sopaymentsOnlylanded in thestandardLayoutslot and the realpaymentsOnlywas silently dropped -- both flags were broken. The params-object refactor eliminates the positional coupling entirely, and the new code also uses the correct SDK argument order (categoryID, categoryID2, optionID, optionID2).Testing
npm run buildpasses.npm run lintpasses with no new warnings.🤖 Generated with Claude Code