Skip to main content
Glama
XeroAPI

Xero MCP Server

Official

list-payroll-leave-types

Retrieve all configured leave types from Xero Payroll, including statutory and organization-specific categories, to manage employee leave policies.

Instructions

Lists all available leave types in Xero Payroll. This provides information about all the leave categories configured in your Xero system, including statutory and organization-specific leave types.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main tool handler: defines the 'list-payroll-leave-types' tool using CreateXeroTool. Includes empty input schema, description, and async executor that calls the Xero handler, handles errors, and formats leave types as text blocks.
    const ListPayrollLeaveTypesTool = CreateXeroTool(
      "list-payroll-leave-types",
      "Lists all available leave types in Xero Payroll. This provides information about all the leave categories configured in your Xero system, including statutory and organization-specific leave types.",
      {},
      async () => {
        const response = await listXeroPayrollLeaveTypes();
        if (response.isError) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error listing payroll leave types: ${response.error}`,
              },
            ],
          };
        }
    
        const leaveTypes = response.result;
    
        return {
          content: [
            {
              type: "text" as const,
              text: `Found ${leaveTypes?.length || 0} payroll leave types:`,
            },        ...(leaveTypes?.map((leaveType: LeaveType) => ({
              type: "text" as const,
              text: [
                `Leave Type: ${leaveType.name || "Unnamed"}`,
                `Leave Type ID: ${leaveType.leaveTypeID || "Unknown"}`,
                leaveType.isPaidLeave !== undefined ? `Is Paid Leave: ${leaveType.isPaidLeave ? 'Yes' : 'No'}` : null,
                leaveType.showOnPayslip !== undefined ? `Show On Payslip: ${leaveType.showOnPayslip ? 'Yes' : 'No'}` : null,
                leaveType.isActive !== undefined ? `Is Active: ${leaveType.isActive ? 'Yes' : 'No'}` : null,
                leaveType.typeOfUnits ? `Type Of Units: ${leaveType.typeOfUnits}` : null,
                leaveType.typeOfUnitsToAccrue ? `Type Of Units To Accrue: ${leaveType.typeOfUnitsToAccrue}` : null,
                leaveType.updatedDateUTC ? `Last Updated: ${leaveType.updatedDateUTC}` : null,
              ]
                .filter(Boolean)
                .join("\n"),
            })) || []),
          ],
        };
      },
    );
  • Core helper function listXeroPayrollLeaveTypes that fetches leave types from Xero Payroll API via xeroClient.payrollNZApi.getLeaveTypes, handles errors, and returns structured response.
    export async function listXeroPayrollLeaveTypes(): Promise<
      XeroClientResponse<LeaveType[]>
    > {
      try {
        const leaveTypes = await fetchLeaveTypes();
    
        if (!leaveTypes) {
          return {
            result: [],
            isError: false,
            error: null,
          };
        }
    
        return {
          result: leaveTypes,
          isError: false,
          error: null,
        };
      } catch (error) {
        return {
          result: null,
          isError: true,
          error: formatError(error),
        };
      }
    }
  • Internal helper to perform the actual Xero API call to retrieve leave types.
    async function fetchLeaveTypes(): Promise<LeaveType[] | null> {
      await xeroClient.authenticate();
    
      const response = await xeroClient.payrollNZApi.getLeaveTypes(
        xeroClient.tenantId,
        undefined, // page
        undefined, // pageSize
        getClientHeaders(),
      );
    
      return response.body.leaveTypes ?? null;
    }
  • Registration: ListPayrollLeaveTypesTool is included in the ListTools array export (line 52). This array is likely imported and registered in the 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
    ];
  • Import statement for the ListPayrollLeaveTypesTool in the tools index.
    import ListPayrollLeaveTypesTool from "./list-payroll-leave-types.tool.js";
Behavior2/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 mentions the tool lists leave types but doesn't cover critical aspects like authentication requirements, rate limits, pagination, error handling, or what the output format looks like (e.g., JSON structure). This leaves significant gaps for an agent to use it effectively.

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 two sentences that efficiently convey the tool's function and scope without redundancy. It's front-loaded with the core purpose and adds clarifying detail in the second sentence. There's no wasted text, though it could be slightly more structured for readability.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the return values include (e.g., fields like leave type IDs, names, accrual rules) or behavioral traits like response format, making it hard for an agent to interpret results. For a list tool with no structured output documentation, this is inadequate.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, focusing instead on the tool's purpose. A baseline of 4 is applied since no parameters exist, and the description doesn't add unnecessary param details.

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

Purpose4/5

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

The description clearly states the verb ('Lists') and resource ('all available leave types in Xero Payroll'), specifying the scope ('statutory and organization-specific leave types'). However, it doesn't explicitly differentiate from the sibling 'list-payroll-employee-leave-types', which appears to be a related but distinct tool for employee-specific leave types.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'list-payroll-employee-leave-types' or other payroll-related tools. The description only states what it does without context about prerequisites, timing, or comparisons to siblings.

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