Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYesThe ID of the time entry to update
project_idNoUpdate the project ID
task_idNoUpdate the task ID
spent_dateNoUpdate the spent date (YYYY-MM-DD)
started_timeNoUpdate start time in HH:MM format
ended_timeNoUpdate end time in HH:MM format
hoursNoUpdate decimal hours
notesNoUpdate notes
external_referenceNo

Implementation Reference

  • 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');
        }
      }
    }
  • 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),
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ianaleck/harvest-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server