update_time_entry
Modify existing time entries in Harvest by updating project, task, hours, notes, or date fields. Only specified changes are applied to maintain accurate time tracking records.
Instructions
Update an existing time entry. Can modify project, task, hours, notes, and other fields. Only provided fields will be updated.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the time entry to update | |
| project_id | No | Update the project ID | |
| task_id | No | Update the task ID | |
| spent_date | No | Update the spent date (YYYY-MM-DD) | |
| started_time | No | Update start time in HH:MM format | |
| ended_time | No | Update end time in HH:MM format | |
| hours | No | Update decimal hours | |
| notes | No | Update notes | |
| external_reference | No |
Implementation Reference
- src/tools/time-entries.ts:79-95 (handler)The handler class for the update_time_entry tool, which validates input and calls the harvest client to update the entry.
class UpdateTimeEntryHandler implements ToolHandler { constructor(private readonly config: BaseToolConfig) {} async execute(args: Record<string, any>): Promise<CallToolResult> { try { const validatedArgs = validateInput(UpdateTimeEntrySchema, args, 'update time entry'); logger.info('Updating time entry via Harvest API', { timeEntryId: validatedArgs.id }); const timeEntry = await this.config.harvestClient.updateTimeEntry(validatedArgs); return { content: [{ type: 'text', text: JSON.stringify(timeEntry, null, 2) }], }; } catch (error) { return handleMCPToolError(error, 'update_time_entry'); } } } - src/tools/time-entries.ts:243-274 (registration)The registration block for update_time_entry within the registerTimeEntryTools function.
{ tool: { name: 'update_time_entry', description: 'Update an existing time entry. Can modify project, task, hours, notes, and other fields. Only provided fields will be updated.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'The ID of the time entry to update' }, project_id: { type: 'number', description: 'Update the project ID' }, task_id: { type: 'number', description: 'Update the task ID' }, spent_date: { type: 'string', format: 'date', description: 'Update the spent date (YYYY-MM-DD)' }, started_time: { type: 'string', pattern: '^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$', description: 'Update start time in HH:MM format' }, ended_time: { type: 'string', pattern: '^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$', description: 'Update end time in HH:MM format' }, hours: { type: 'number', minimum: 0, maximum: 24, description: 'Update decimal hours' }, notes: { type: 'string', maxLength: 2000, description: 'Update notes' }, external_reference: { type: 'object', properties: { id: { type: 'string' }, group_id: { type: 'string' }, account_id: { type: 'string' }, permalink: { type: 'string', format: 'uri' }, }, additionalProperties: false, }, }, required: ['id'], additionalProperties: false, }, }, handler: new UpdateTimeEntryHandler(config), },