Skip to main content
Glama

Xero MCP Server

Official
MIT License
293
128
  • Apple
  • Linux
list-contact-groups.tool.ts1.78 kB
import { z } from "zod"; import { listXeroContactGroups } from "../../handlers/list-xero-contact-groups.handler.js"; import { CreateXeroTool } from "../../helpers/create-xero-tool.js"; const ListContactGroupsTool = CreateXeroTool( "list-contact-groups", `List all contact groups in Xero. You can optionally specify a contact group ID to retrieve details for that specific group, including its contacts.`, { contactGroupId: z .string() .optional() .describe("Optional ID of the contact group to retrieve"), }, async (args) => { const response = await listXeroContactGroups(args?.contactGroupId); if (response.error !== null) { return { content: [ { type: "text" as const, text: `Error listing contact groups: ${response.error}`, }, ], }; } const contactGroups = response.result; return { content: [ { type: "text" as const, text: `Found ${contactGroups?.length || 0} contact groups:`, }, ...(contactGroups?.map((contactGroup) => ({ type: "text" as const, text: [ `Contact Group ID: ${contactGroup.contactGroupID}`, `Name: ${contactGroup.name}`, `Status: ${contactGroup.status}`, contactGroup.contacts ? contactGroup.contacts.map(contact => [ `Contact ID: ${contact.contactID}`, `Name: ${contact.name}`, ].join('\n') ).join('\n') : "No contacts in this contact group.", ] .filter(Boolean) .join("\n"), })) || []), ], }; }, ); export default ListContactGroupsTool;

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