Skip to main content
Glama
XeroAPI

Xero MCP Server

Official

list-payroll-employees

Retrieve comprehensive employee details from Xero payroll, including names, IDs, contact information, employment types, and start dates for all registered staff.

Instructions

List all payroll employees in Xero. This retrieves comprehensive employee details including names, User IDs, dates of birth, email addresses, gender, phone numbers, start dates, engagement types (Permanent, FixedTerm, or Casual), titles, and when records were last updated. The response presents a complete overview of all staff currently registered in your Xero payroll, with their personal and employment information. If there are many employees, ask the user if they would like to see more detailed information about specific employees before proceeding.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool definition for 'list-payroll-employees', including empty input schema, description, and the main handler function that fetches employees via listXeroPayrollEmployees and formats them into a readable text response.
    const ListPayrollEmployeesTool = CreateXeroTool(
      "list-payroll-employees",
      `List all payroll employees in Xero.
    This retrieves comprehensive employee details including names, User IDs, dates of birth, email addresses, gender, phone numbers, start dates, engagement types (Permanent, FixedTerm, or Casual), titles, and when records were last updated.
    The response presents a complete overview of all staff currently registered in your Xero payroll, with their personal and employment information. If there are many employees, ask the user if they would like to see more detailed information about specific employees before proceeding.`,
      {},
      async () => {
        const response = await listXeroPayrollEmployees();
    
        if (response.isError) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error listing payroll employees: ${response.error}`,
              },
            ],
          };
        }
    
        const employees = response.result;
    
        return {
          content: [
            {
              type: "text" as const,
              text: `Found ${employees?.length || 0} payroll employees:`,
            },
            ...(employees?.map((employee: Employee) => ({
              type: "text" as const,
              text: [
                `Employee: ${employee.employeeID}`,
                employee.email ? `Email: ${employee.email}` : "No email",
                employee.gender ? `Gender: ${employee.gender}` : null,
                employee.phoneNumber ? `Phone: ${employee.phoneNumber}` : null,
                employee.startDate ? `Start Date: ${employee.startDate}` : null,
                employee.engagementType
                  ? `Engagement Type: ${employee.engagementType}`
                  : "No status", // Permanent, FixedTerm, Casual
                employee.title ? `Title: ${employee.title}` : null,
                employee.firstName ? `First Name: ${employee.firstName}` : null,
                employee.lastName ? `Last Name: ${employee.lastName}` : null,
                employee.updatedDateUTC
                  ? `Last Updated: ${employee.updatedDateUTC}`
                  : null,
              ]
                .filter(Boolean)
                .join("\n"),
            })) || []),
          ],
        };
      },
    );
  • Core helper function that authenticates with Xero and retrieves the list of payroll employees using xeroClient.payrollNZApi.getEmployees, with error handling.
    export async function listXeroPayrollEmployees(): Promise<
      XeroClientResponse<Employee[]>
    > {
      try {
        const employees = await getPayrollEmployees();
    
        return {
          result: employees,
          isError: false,
          error: null,
        };
      } catch (error) {
        return {
          result: null,
          isError: true,
          error: formatError(error),
        };
      }
    }
  • Registers ListPayrollEmployeesTool (imported at line 19) in the ListTools array, which is used by tool-factory to register to MCP server.
    export const ListTools = [
      ListAccountsTool,
      ListContactsTool,
      ListCreditNotesTool,
      ListInvoicesTool,
      ListItemsTool,
      ListManualJournalsTool,
      ListQuotesTool,
      ListTaxRatesTool,
      ListTrialBalanceTool,
      ListPaymentsTool,
      ListProfitAndLossTool,
      ListBankTransactionsTool,
      ListPayrollEmployeesTool,
      ListReportBalanceSheetTool,
      ListOrganisationDetailsTool,
      ListPayrollEmployeeLeaveTool,
      ListPayrollLeavePeriodsToolTool,
      ListPayrollEmployeeLeaveTypesTool,
      ListPayrollEmployeeLeaveBalancesTool,
      ListPayrollLeaveTypesTool,
      ListAgedReceivablesByContact,
      ListAgedPayablesByContact,
      ListPayrollTimesheetsTool,
      ListContactGroupsTool,
      ListTrackingCategoriesTool
    ];
  • Calls server.tool() to register all tools from ListTools (imported line 6), including 'list-payroll-employees', to the MCP server.
    ListTools.map((tool) => tool()).forEach((tool) =>
      server.tool(tool.name, tool.description, tool.schema, tool.handler),
    );
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the tool as a retrieval operation ('retrieves comprehensive employee details') and mentions the response format ('complete overview'), but does not cover potential limitations like rate limits, authentication needs, or whether the data is real-time. It adds some context about handling large datasets, but could be more comprehensive for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the core purpose ('List all payroll employees in Xero') followed by details on what is retrieved. The second sentence elaborates on the response, and the third provides user interaction guidance. While efficient, the third sentence could be more concise or integrated better, but overall it earns its place without significant waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a list operation with no parameters but potentially large output), no annotations, and no output schema, the description is moderately complete. It explains what data is retrieved and hints at handling large datasets, but lacks details on output format (e.g., pagination, structure) or error conditions. For a tool with no structured output documentation, more guidance on the response would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema already documents this fully. The description appropriately does not discuss parameters, maintaining focus on the tool's purpose and output. This meets the baseline of 4 for tools with no parameters, as it avoids unnecessary parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific verb ('List') and resource ('payroll employees in Xero'), and distinguishes this tool from siblings like 'list-payroll-employee-leave' or 'list-payroll-employee-leave-balances' by focusing on comprehensive employee details rather than leave-related data. It explicitly mentions retrieving 'comprehensive employee details' with specific examples of fields included.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving a complete overview of all staff, but does not explicitly state when to use this tool versus alternatives like 'list-contacts' or 'list-payroll-leave-types'. It provides some context about handling many employees ('ask the user if they would like to see more detailed information'), but lacks clear exclusions or direct comparisons to sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

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