list-bank-transactions
Retrieve and display bank transactions from Xero, optionally filtered by specific accounts, with pagination support for comprehensive financial review.
Instructions
List all bank transactions in Xero. Ask the user if they want to see bank transactions for a specific bank account, or to see all bank transactions before running. Ask the user if they want the next page of quotes after running this tool if 10 bank transactions are returned. If they do, call this tool again with the next page number and the bank account if one was provided in the provided in the previous call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | Yes | ||
| bankAccountId | No |
Implementation Reference
- The primary handler function for the MCP tool 'list-bank-transactions', which processes input, calls the Xero API via helper, and formats the response as text content blocks.async ({ bankAccountId, page }) => { const response = await listXeroBankTransactions(page, bankAccountId); if (response.isError) { return { content: [ { type: "text" as const, text: `Error listing bank transactions: ${response.error}` } ] }; } const bankTransactions = response.result; return { content: [ { type: "text" as const, text: `Found ${bankTransactions?.length || 0} bank transactions:` }, ...(bankTransactions?.map((transaction) => ({ type: "text" as const, text: [ `Bank Transaction ID: ${transaction.bankTransactionID}`, `Bank Account: ${transaction.bankAccount.name} (${transaction.bankAccount.accountID})`, transaction.contact ? `Contact: ${transaction.contact.name} (${transaction.contact.contactID})` : null, transaction.reference ? `Reference: ${transaction.reference}` : null, transaction.date ? `Date: ${transaction.date}` : null, transaction.subTotal ? `Sub Total: ${transaction.subTotal}` : null, transaction.totalTax ? `Total Tax: ${transaction.totalTax}` : null, transaction.total ? `Total: ${transaction.total}` : null, transaction.isReconciled !== undefined ? (`${transaction.isReconciled ? "Reconciled" : "Unreconciled"}`) : null, transaction.currencyCode ? `Currency Code: ${transaction.currencyCode}` : null, `${transaction.status || "Unknown"}`, transaction.lineAmountTypes ? `Line Amount Types: ${transaction.lineAmountTypes}` : undefined, transaction.hasAttachments !== undefined ? (transaction.hasAttachments ? "Has attachments" : "Does not have attachments") : null, `Line Items: ${transaction.lineItems?.map(formatLineItem)}`, ].filter(Boolean).join("\n") })) || []) ] }; }
- Zod input schema defining parameters: page (number) and optional bankAccountId (string).page: z.number(), bankAccountId: z.string().optional() },
- src/tools/list/index.ts:32-58 (registration)Registration of the ListBankTransactionsTool in the array of list tools exported as ListTools, likely used for MCP tool registration.export const ListTools = [ ListAccountsTool, ListContactsTool, ListCreditNotesTool, ListInvoicesTool, ListItemsTool, ListManualJournalsTool, ListQuotesTool, ListTaxRatesTool, ListTrialBalanceTool, ListPaymentsTool, ListProfitAndLossTool, ListBankTransactionsTool, ListPayrollEmployeesTool, ListReportBalanceSheetTool, ListOrganisationDetailsTool, ListPayrollEmployeeLeaveTool, ListPayrollLeavePeriodsToolTool, ListPayrollEmployeeLeaveTypesTool, ListPayrollEmployeeLeaveBalancesTool, ListPayrollLeaveTypesTool, ListAgedReceivablesByContact, ListAgedPayablesByContact, ListPayrollTimesheetsTool, ListContactGroupsTool, ListTrackingCategoriesTool ];
- Supporting handler utility that wraps the Xero API call to retrieve bank transactions, handling errors and returning structured response.export async function listXeroBankTransactions( page: number = 1, bankAccountId?: string ): Promise<XeroClientResponse<BankTransaction[]>> { try { const bankTransactions = await getBankTransactions(page, bankAccountId); return { result: bankTransactions, isError: false, error: null } } catch (error) { return { result: null, isError: true, error: formatError(error) } } }