update_task
Modify existing tasks in Harvest time tracking by updating name, billing settings, or activity status with only the fields you specify.
Instructions
Update an existing task. Can modify task name, billing settings, and activity status. Only provided fields will be updated.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the task to update (required) | |
| name | No | Update task name | |
| billable_by_default | No | Update default billing status | |
| default_hourly_rate | No | Update default hourly rate | |
| is_default | No | Update default task status | |
| is_active | No | Update active status |
Implementation Reference
- src/tools/tasks.ts:76-92 (handler)The handler class UpdateTaskHandler contains the logic to execute the 'update_task' tool by calling the Harvest API.
class UpdateTaskHandler implements ToolHandler { constructor(private readonly config: BaseToolConfig) {} async execute(args: Record<string, any>): Promise<CallToolResult> { try { const validatedArgs = validateInput(UpdateTaskSchema, args, 'update task'); logger.info('Updating task via Harvest API', { taskId: validatedArgs.id }); const task = await this.config.harvestClient.updateTask(validatedArgs); return { content: [{ type: 'text', text: JSON.stringify(task, null, 2) }], }; } catch (error) { return handleMCPToolError(error, 'update_task'); } } } - src/tools/tasks.ts:167-186 (registration)The registration of the 'update_task' tool in the registerTaskTools function, linking it to the UpdateTaskHandler.
{ tool: { name: 'update_task', description: 'Update an existing task. Can modify task name, billing settings, and activity status. Only provided fields will be updated.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'The ID of the task to update (required)' }, name: { type: 'string', minLength: 1, description: 'Update task name' }, billable_by_default: { type: 'boolean', description: 'Update default billing status' }, default_hourly_rate: { type: 'number', minimum: 0, description: 'Update default hourly rate' }, is_default: { type: 'boolean', description: 'Update default task status' }, is_active: { type: 'boolean', description: 'Update active status' }, }, required: ['id'], additionalProperties: false, }, }, handler: new UpdateTaskHandler(config), },