Skip to main content
Glama

Xero MCP Server

Official
MIT License
293
128
  • Apple
  • Linux
list-accounts.tool.ts1.46 kB
import { listXeroAccounts } from "../../handlers/list-xero-accounts.handler.js"; import { CreateXeroTool } from "../../helpers/create-xero-tool.js"; const ListAccountsTool = CreateXeroTool( "list-accounts", "Lists all accounts in Xero. Use this tool to get the account codes and names to be used when creating invoices in Xero", {}, async () => { const response = await listXeroAccounts(); if (response.error !== null) { return { content: [ { type: "text" as const, text: `Error listing accounts: ${response.error}`, }, ], }; } const accounts = response.result; return { content: [ { type: "text" as const, text: `Found ${accounts?.length || 0} accounts:`, }, ...(accounts?.map((account) => ({ type: "text" as const, text: [ `Account: ${account.name || "Unnamed"}`, `Code: ${account.code || "No code"}`, `ID: ${account.accountID || "No ID"}`, `Type: ${account.type || "Unknown type"}`, `Status: ${account.status || "Unknown status"}`, account.description ? `Description: ${account.description}` : null, account.taxType ? `Tax Type: ${account.taxType}` : null, ] .filter(Boolean) .join("\n"), })) || []), ], }; }, ); export default ListAccountsTool;

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