delete_user
Archive a user account to preserve time tracking history while removing active access. This action maintains historical data rather than permanently deleting records.
Instructions
Delete (archive) a user. This action archives the user rather than permanently deleting them, preserving time tracking history.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes | The ID of the user to delete |
Implementation Reference
- src/tools/users.ts:111-129 (handler)The implementation of the delete_user tool handler logic.
class DeleteUserHandler implements ToolHandler { constructor(private readonly config: BaseToolConfig) {} async execute(args: Record<string, any>): Promise<CallToolResult> { try { const inputSchema = z.object({ user_id: z.number().int().positive() }); const { user_id } = validateInput(inputSchema, args, 'delete user'); logger.info('Deleting user via Harvest API', { userId: user_id }); await this.config.harvestClient.deleteUser(user_id); return { content: [{ type: 'text', text: JSON.stringify({ message: `User ${user_id} deleted successfully` }, null, 2) }], }; } catch (error) { return handleMCPToolError(error, 'delete_user'); } } } - src/tools/users.ts:238-252 (registration)Registration of the delete_user tool, defining its schema and linking it to the handler.
{ tool: { name: 'delete_user', description: 'Delete (archive) a user. This action archives the user rather than permanently deleting them, preserving time tracking history.', inputSchema: { type: 'object', properties: { user_id: { type: 'number', description: 'The ID of the user to delete' }, }, required: ['user_id'], additionalProperties: false, }, }, handler: new DeleteUserHandler(config), },