update_time_entry
Modify an existing time entry in Clockify by updating details such as start/end times, description, project, task, tags, and billable status using workspace and time entry IDs.
Instructions
Update an existing time entry
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| billable | No | Whether the entry is billable | |
| description | No | Time entry description | |
| end | No | End time (ISO 8601 format) | |
| projectId | No | Project ID | |
| start | No | Start time (ISO 8601 format) | |
| tagIds | No | Array of tag IDs | |
| taskId | No | Task ID | |
| timeEntryId | Yes | Time entry ID | |
| workspaceId | Yes | Workspace ID |
Implementation Reference
- src/index.ts:326-342 (registration)Registration of the 'update_time_entry' tool including its name, description, and input schema definition.name: "update_time_entry", description: "Update an existing time entry", inputSchema: { type: "object", properties: { workspaceId: { type: "string", description: "Workspace ID" }, timeEntryId: { type: "string", description: "Time entry ID" }, description: { type: "string", description: "Time entry description" }, start: { type: "string", description: "Start time (ISO 8601 format)" }, end: { type: "string", description: "End time (ISO 8601 format)" }, projectId: { type: "string", description: "Project ID" }, taskId: { type: "string", description: "Task ID" }, tagIds: { type: "array", items: { type: "string" }, description: "Array of tag IDs" }, billable: { type: "boolean", description: "Whether the entry is billable" }, }, required: ["workspaceId", "timeEntryId"], },
- src/index.ts:947-972 (handler)The core handler function that updates a time entry by making a PUT request to the Clockify API endpoint `/workspaces/{workspaceId}/time-entries/{timeEntryId}` with the provided update data, handles date formatting, and returns a success message.private async updateTimeEntry(args: any) { const { workspaceId, timeEntryId, ...updateData } = args; // Ensure dates are in ISO format if (updateData.start && !updateData.start.includes("T")) { updateData.start = new Date(updateData.start).toISOString(); } if (updateData.end && !updateData.end.includes("T")) { updateData.end = new Date(updateData.end).toISOString(); } const timeEntry = await this.makeRequest( `/workspaces/${workspaceId}/time-entries/${timeEntryId}`, "PUT", updateData ); return { content: [ { type: "text", text: `Time entry updated successfully!\nID: ${timeEntry.id}\nDescription: ${timeEntry.description || "No description"}\nStart: ${timeEntry.timeInterval.start}\nEnd: ${timeEntry.timeInterval.end || "Ongoing"}`, }, ], isError: false, };
- src/index.ts:737-739 (handler)Dispatch logic in the CallToolRequestSchema handler that validates parameters and calls the updateTimeEntry method.case "update_time_entry": if (!args?.workspaceId || !args?.timeEntryId) throw new McpError(ErrorCode.InvalidParams, 'workspaceId and timeEntryId are required'); return await this.updateTimeEntry(args as any);