UNPKG

xero-mcp

Version:

A Model Context Protocol server allows Clients to interact with Xero

37 lines (36 loc) 1.25 kB
import { XeroClientSession } from "../../XeroApiClient.js"; export const ListAccountsTool = { requestSchema: { name: "list_accounts", description: "Retrieves the full chart of accounts", inputSchema: { type: "object", properties: { where: { type: "string", description: "Filter by an any element", example: 'Status=="ACTIVE" AND Type=="BANK"', }, order: { type: "string", description: "Order by any element", example: "Name ASC", }, }, }, }, requestHandler: async (request) => { const where = request.params.arguments?.where; const order = request.params.arguments?.order; const response = await XeroClientSession.xeroClient.accountingApi.getAccounts(XeroClientSession.activeTenantId(), undefined, where, order); const accounts = response.body.accounts || []; return { content: [ { type: "text", text: JSON.stringify(accounts), }, ], }; }, };