Skip to main content
Glama

Xero MCP Server

Official
MIT License
293
128
  • Apple
  • Linux
list-payroll-employee-leave-balances.tool.ts1.84 kB
import { z } from "zod"; import { listXeroPayrollEmployeeLeaveBalances } from "../../handlers/list-xero-payroll-employee-leave-balances.handler.js"; import { CreateXeroTool } from "../../helpers/create-xero-tool.js"; import { EmployeeLeaveBalance } from "xero-node/dist/gen/model/payroll-nz/employeeLeaveBalance.js"; const ListPayrollEmployeeLeaveBalancesTool = CreateXeroTool( "list-payroll-employee-leave-balances", "List all leave balances for a specific employee in Xero. This shows current leave balances for all leave types available to the employee, including annual, sick, and other leave types.", { employeeId: z.string().describe("The Xero employee ID to fetch leave balances for"), }, async ({ employeeId }) => { const response = await listXeroPayrollEmployeeLeaveBalances(employeeId); if (response.isError) { return { content: [ { type: "text" as const, text: `Error listing employee leave balances: ${response.error}`, }, ], }; } const leaveBalances = response.result; return { content: [ { type: "text" as const, text: `Found ${leaveBalances?.length || 0} leave balances for employee ${employeeId}:`, }, ...(leaveBalances?.map((balance: EmployeeLeaveBalance) => ({ type: "text" as const, text: [ `Leave Type ID: ${balance.leaveTypeID || "Unknown"}`, `Name: ${balance.name || "Unnamed"}`, balance.typeOfUnits ? `Type Of Units: ${balance.typeOfUnits}` : null, balance.balance !== undefined ? `Current Balance: ${balance.balance}` : null, ] .filter(Boolean) .join("\n"), })) || []), ], }; }, ); export default ListPayrollEmployeeLeaveBalancesTool;

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