Skip to main content
Glama

Xero MCP Server

Official
MIT License
293
128
  • Apple
  • Linux
list-aged-receivables-by-contact.handler.ts1.54 kB
import { xeroClient } from "../clients/xero-client.js"; import { XeroClientResponse } from "../types/tool-response.js"; import { formatError } from "../helpers/format-error.js"; import { getClientHeaders } from "../helpers/get-client-headers.js"; import { ReportWithRow } from "xero-node"; async function listAgedReceivablesByContact( contactId: string, reportDate?: string, invoicesFromDate?: string, invoicesToDate?: string ): Promise<ReportWithRow | undefined> { await xeroClient.authenticate(); const response = await xeroClient.accountingApi.getReportAgedReceivablesByContact( xeroClient.tenantId, // xeroTenantId contactId, // contactId reportDate, // date invoicesFromDate, // fromDate invoicesToDate, // toDate getClientHeaders() ); return response.body.reports?.[0]; } export async function listXeroAgedReceivablesByContact( contactId: string, reportDate?: string, invoicesFromDate?: string, invoicesToDate?: string ): Promise<XeroClientResponse<ReportWithRow>> { try { const agedReceivables = await listAgedReceivablesByContact(contactId, reportDate, invoicesFromDate, invoicesToDate); if (!agedReceivables) { return { result: null, isError: true, error: "Failed to get aged receivables by contact from Xero." }; } return { result: agedReceivables, isError: false, error: null }; } catch (error) { return { result: null, isError: true, error: formatError(error), }; } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/XeroAPI/xero-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server