UNPKG

xero-mcp

Version:

A Model Context Protocol server allows Clients to interact with Xero

43 lines (42 loc) 1.53 kB
import { XeroClientSession } from "../../XeroApiClient.js"; export const ListPaymentsTool = { requestSchema: { name: "list_payments", description: "Retrieves payments for invoices and credit notes", inputSchema: { type: "object", properties: { where: { type: "string", description: "Filter payments by any element", example: 'Status=="AUTHORISED"', }, order: { type: "string", description: "Order by any element", example: "Amount ASC", }, page: { type: "integer", description: "Up to 100 payments will be returned in a single API call", example: 1, }, }, }, }, requestHandler: async (request) => { const where = request.params.arguments?.where; const order = request.params.arguments?.order; const page = request.params.arguments?.page; const response = await XeroClientSession.xeroClient.accountingApi.getPayments(XeroClientSession.activeTenantId(), undefined, where, order, page); const payments = response.body.payments || []; return { content: [ { type: "text", text: JSON.stringify(payments), }, ], }; }, };