Enhance list-invoices with advanced filtering (Type, status, dates, amounts)#110
Open
cesarho wants to merge 1 commit into
Open
Enhance list-invoices with advanced filtering (Type, status, dates, amounts)#110cesarho wants to merge 1 commit into
cesarho wants to merge 1 commit into
Conversation
… README. - Updated the `list-invoices` tool to support advanced filtering capabilities, including a required 'where' parameter for invoice types and additional filtering options for statuses, dates, and amounts. - Refactored the `getInvoices` function to accept a single parameter object for better clarity and usability. - Revised the README to reflect the new advanced filtering features for the `list-invoices` command.
rathga
added a commit
to rathga/xero-mcp-server
that referenced
this pull request
Jun 15, 2026
…ense prep) create-linked-transaction needs a bill line's sourceLineItemId, and the only way to read line-item IDs via MCP is list-invoices. Until now that tool only printed line items when filtering by invoiceNumbers — but email-imported bills frequently have no InvoiceNumber, so their line-item IDs were unreadable and the billable-expense flow couldn't be driven for them. Add an invoiceIds filter to list-invoices (threaded into the existing getInvoices iDs slot) and return line items for invoiceIds fetches as well, so any bill — numbered or not — can have its Line Item IDs read by ID. This completes the "surface Line Item ID" half of this PR for the no-InvoiceNumber case. Note: PR XeroAPI#110 also introduces an invoiceIds filter (among broader list-invoices filters); this adds the minimal slice needed for the linked-transaction flow and supersedes that part of XeroAPI#110 for this purpose. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Cross-reference for reconciliation: #191 (linked-transaction / billable-expense tools) now adds a minimal |
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.
Add advanced filtering capabilities to list-invoices tool
Summary
This PR enhances the
list-invoicestool with comprehensive filtering options, enabling more precise invoice queries through the Xero API. The changes add support for filtering by invoice IDs, statuses, customwhereclauses, and customizable ordering.Changes
New Filtering Parameters
invoiceIds: Filter invoices by specific invoice IDs (array of strings)statuses: Filter by invoice statuses - DRAFT, SUBMITTED, DELETED, AUTHORISED, PAID, VOIDED (array of strings)where: Advanced filtering using Xero's where clause syntax for complex queries including:order: Customizable ordering (defaults to "UpdatedDateUTC DESC")Implementation Details
listXeroInvoiceshandler to use aListInvoicesParamsinterface for better type safetypageparameter optional with default value of 1whereparameter)Updated Files
src/tools/list/list-invoices.tool.ts: Added new parameters and comprehensive documentationsrc/handlers/list-xero-invoices.handler.ts: Refactored to support new filtering optionsREADME.md: Updated tool description to reflect advanced filtering capabilitiesBenefits
Example Use Cases
where=Type=="ACCREC"where=Type=="ACCPAY"where=DueDate<DateTime(2024,12,01) AND Status=="AUTHORISED"statuses=["AUTHORISED","PAID"]where=Type=="ACCREC" AND Status=="AUTHORISED" AND AmountDue>1000