update_user
Modify user profiles, permissions, and billing rates in Harvest time tracking. Update specific fields like name, email, roles, access levels, and rates without affecting unchanged data.
Instructions
Update an existing user's profile, permissions, and rates. Only provided fields will be updated.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the user to update (required) | |
| first_name | No | Update first name | |
| last_name | No | Update last name | |
| No | Update email address | ||
| telephone | No | Update phone number | |
| timezone | No | Update timezone | |
| has_access_to_all_future_projects | No | Update future project access | |
| is_contractor | No | Update contractor status | |
| is_admin | No | Update admin privileges | |
| is_project_manager | No | Update project manager role | |
| can_see_rates | No | Update rate visibility | |
| can_create_projects | No | Update project creation permission | |
| can_create_invoices | No | Update invoice creation permission | |
| is_active | No | Update active status | |
| weekly_capacity | No | Update weekly capacity | |
| default_hourly_rate | No | Update default hourly rate | |
| cost_rate | No | Update cost rate |
Implementation Reference
- src/tools/users.ts:93-109 (handler)The UpdateUserHandler class implements the tool logic, validating the input with UpdateUserSchema and calling the harvestClient.updateUser method.
class UpdateUserHandler implements ToolHandler { constructor(private readonly config: BaseToolConfig) {} async execute(args: Record<string, any>): Promise<CallToolResult> { try { const validatedArgs = validateInput(UpdateUserSchema, args, 'update user'); logger.info('Updating user via Harvest API', { userId: validatedArgs.id }); const user = await this.config.harvestClient.updateUser(validatedArgs); return { content: [{ type: 'text', text: JSON.stringify(user, null, 2) }], }; } catch (error) { return handleMCPToolError(error, 'update_user'); } } } - src/tools/users.ts:208-237 (registration)Registration of the 'update_user' tool, including its schema definition and handler instance.
tool: { name: 'update_user', description: 'Update an existing user\'s profile, permissions, and rates. Only provided fields will be updated.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'The ID of the user to update (required)' }, first_name: { type: 'string', minLength: 1, description: 'Update first name' }, last_name: { type: 'string', minLength: 1, description: 'Update last name' }, email: { type: 'string', format: 'email', description: 'Update email address' }, telephone: { type: 'string', description: 'Update phone number' }, timezone: { type: 'string', description: 'Update timezone' }, has_access_to_all_future_projects: { type: 'boolean', description: 'Update future project access' }, is_contractor: { type: 'boolean', description: 'Update contractor status' }, is_admin: { type: 'boolean', description: 'Update admin privileges' }, is_project_manager: { type: 'boolean', description: 'Update project manager role' }, can_see_rates: { type: 'boolean', description: 'Update rate visibility' }, can_create_projects: { type: 'boolean', description: 'Update project creation permission' }, can_create_invoices: { type: 'boolean', description: 'Update invoice creation permission' }, is_active: { type: 'boolean', description: 'Update active status' }, weekly_capacity: { type: 'number', minimum: 0, description: 'Update weekly capacity' }, default_hourly_rate: { type: 'number', minimum: 0, description: 'Update default hourly rate' }, cost_rate: { type: 'number', minimum: 0, description: 'Update cost rate' }, }, required: ['id'], additionalProperties: false, }, }, handler: new UpdateUserHandler(config), },