Skip to content

feat: add list-payroll-calendars and list-earnings-rates tools#169

Open
elliotchisholm wants to merge 4 commits into
XeroAPI:mainfrom
elliotchisholm:feat/au-v2/5-payroll-calendar-tools
Open

feat: add list-payroll-calendars and list-earnings-rates tools#169
elliotchisholm wants to merge 4 commits into
XeroAPI:mainfrom
elliotchisholm:feat/au-v2/5-payroll-calendar-tools

Conversation

@elliotchisholm

Copy link
Copy Markdown
Contributor

Summary

Adds two new MCP tools:

  • list-payroll-calendars — lists payroll calendars for an organisation
  • list-earnings-rates — lists earnings rates for an organisation

Why

The AU v2 create-timesheet tool requires a payrollCalendarID, and add-timesheet-line requires an earningsRateID. Without these listing tools, callers had no way to look up the required IDs via MCP.

Note for reviewer

This is part of a stacked series — please merge in order (#165#168 first). Once those merge into main, this PR's diff will show only these changes.


Part 5 of 8 — AU timesheet v2 migration stack.

elliotchisholm and others added 4 commits June 5, 2026 20:16
- Upgrade xero-node from ^13.3.0 to ^15.0.1
- Add PayrollAuV2Api client to xero-client.ts with lazy init and token sync
- Add payroll-au-v2-types.ts shim for AU v2 Timesheet/TimesheetLine types
- Fix SDK breaking change: hoursAccruedAnnually renamed to unitsAccruedAnnually
- Add vitest for test infrastructure

The PayrollAuV2Api is a separate class not wired into XeroClient, so it
requires manual instantiation and access token management.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace all AU-specific workaround code with v2 API calls via
PayrollAuV2Api. This aligns AU with NZ/UK — all three regions now use
the same v2 endpoint patterns.

Changes per handler:
- approve: remove GET-then-PUT status workaround, call approveTimesheet
- revert: remove GET-then-PUT status workaround, call revertTimesheet
- delete: remove AU error block, call deleteTimesheet (previously unsupported)
- create: remove array wrapping, use single-object createTimesheet
- add-line: remove GET-append-PUT workaround, call createTimesheetLine
- update-line: remove earningsRateID matching, call updateTimesheetLine by ID
- get: call getTimesheet via v2 client
- list: remove AU-only params (where/order/ifModifiedSince), use v2 params

Breaking input changes for AU callers:
- numberOfUnits is now a single number (not array) with a date per line
- payrollCalendarID is now required on create
- timesheetLineID is now required on update-line

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New handler, tool, and tests for DELETE /timesheets/{id}/lines/{lineId}.
Previously this operation had no MCP tool. Supports AU (via
PayrollAuV2Api), NZ, and UK.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New tools:
- list-payroll-calendars: shows pay calendar names, types, and upcoming
  payment dates. AU uses payrollAUApi.getPayrollCalendars (v1), NZ/UK
  use getPayRunCalendars.
- list-earnings-rates: shows earnings rate IDs, names, and types needed
  for creating timesheet lines. AU uses payrollAUApi.getPayItems (v1)
  and extracts the earningsRates array, NZ/UK use getEarningsRates.

Both tools support AU, NZ, and UK with region auto-detection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@elliotchisholm elliotchisholm force-pushed the feat/au-v2/5-payroll-calendar-tools branch from 2be4430 to 3cc877c Compare June 5, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant