delete_time_entry
Remove a time entry permanently from Harvest time tracking. This action cannot be undone, so use it to correct errors or clean up records.
Instructions
Delete a time entry permanently. This action cannot be undone.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| time_entry_id | Yes | The ID of the time entry to delete |
Implementation Reference
- src/tools/time-entries.ts:97-113 (handler)The handler class DeleteTimeEntryHandler implements the tool execution logic for deleting a time entry, including input validation, calling the Harvest API, and error handling.
class DeleteTimeEntryHandler implements ToolHandler { constructor(private readonly config: BaseToolConfig) {} async execute(args: Record<string, any>): Promise<CallToolResult> { try { const inputSchema = z.object({ time_entry_id: z.number().int().positive() }); const { time_entry_id } = validateInput(inputSchema, args, 'delete time entry'); logger.info('Deleting time entry via Harvest API', { timeEntryId: time_entry_id }); await this.config.harvestClient.deleteTimeEntry(time_entry_id); return { content: [{ type: 'text', text: JSON.stringify({ message: `Time entry ${time_entry_id} deleted successfully` }, null, 2) }], }; } catch (error) { return handleMCPToolError(error, 'delete_time_entry'); } - src/tools/time-entries.ts:276-289 (registration)The registration of the 'delete_time_entry' tool within the time entries tool definitions.
tool: { name: 'delete_time_entry', description: 'Delete a time entry permanently. This action cannot be undone.', inputSchema: { type: 'object', properties: { time_entry_id: { type: 'number', description: 'The ID of the time entry to delete' }, }, required: ['time_entry_id'], additionalProperties: false, }, }, handler: new DeleteTimeEntryHandler(config), },