Skip to main content
Glama
XeroAPI

Xero MCP Server

Official

delete-timesheet

Remove a payroll timesheet from Xero using its unique identifier to correct errors or update records.

Instructions

Delete an existing payroll timesheet in Xero by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timesheetIDYesThe ID of the timesheet to delete.

Implementation Reference

  • Core handler that deletes the payroll timesheet via Xero PayrollNZ API, handling errors and returning structured response.
    export async function deleteXeroPayrollTimesheet(timesheetID: string): Promise< XeroClientResponse<boolean> > { try { await deleteTimesheet(timesheetID); return { result: true, isError: false, error: null, }; } catch (error) { return { result: null, isError: true, error: formatError(error), }; } }
  • Input schema for the delete-timesheet tool using Zod.
    { timesheetID: z.string().describe("The ID of the timesheet to delete."), },
  • Defines and exports the MCP tool 'delete-timesheet' with name, description, schema, and wrapper handler.
    const DeletePayrollTimesheetTool = CreateXeroTool( "delete-timesheet", `Delete an existing payroll timesheet in Xero by its ID.`, { timesheetID: z.string().describe("The ID of the timesheet to delete."), }, async (params: { timesheetID: string }) => { const { timesheetID } = params; const response = await deleteXeroPayrollTimesheet(timesheetID); if (response.isError) { return { content: [ { type: "text" as const, text: `Error deleting timesheet: ${response.error}`, }, ], }; } return { content: [ { type: "text" as const, text: `Successfully deleted timesheet with ID: ${timesheetID}`, }, ], }; }, );
  • Low-level helper function that authenticates and calls the Xero API to delete the timesheet.
    async function deleteTimesheet(timesheetID: string): Promise<boolean> { await xeroClient.authenticate(); // Call the deleteTimesheet endpoint from the PayrollNZApi await xeroClient.payrollNZApi.deleteTimesheet(xeroClient.tenantId, timesheetID); return true; }

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