stop_time_entry
Stop active time tracking in Clockify by ending the current time entry. This tool halts ongoing work sessions to ensure accurate time records for billing and productivity analysis.
Instructions
Stop a running time entry
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspaceId | Yes | Workspace ID | |
| userId | Yes | User ID | |
| end | No | End time (ISO 8601 format, optional - defaults to now) |
Implementation Reference
- src/index.ts:992-1011 (handler)The main handler function for the 'stop_time_entry' tool. It takes workspaceId, userId, and optional end time, then sends a PATCH request to the Clockify API endpoint `/workspaces/{workspaceId}/user/{userId}/time-entries` with the end time to stop the running time entry. Returns a success message with the end time and duration.private async stopTimeEntry(args: any) { const { workspaceId, userId, end } = args; const endTime = end || new Date().toISOString(); const result = await this.makeRequest( `/workspaces/${workspaceId}/user/${userId}/time-entries`, "PATCH" as "PATCH", { end: endTime } ); return { content: [ { type: "text", text: `Time entry stopped at ${endTime}\nDuration: ${result.timeInterval.duration}`, }, ], isError: false, }; }
- src/index.ts:359-367 (schema)The input schema definition for the 'stop_time_entry' tool, specifying required workspaceId and userId, and optional end time as string in ISO 8601 format.inputSchema: { type: "object", properties: { workspaceId: { type: "string", description: "Workspace ID" }, userId: { type: "string", description: "User ID" }, end: { type: "string", description: "End time (ISO 8601 format, optional - defaults to now)" }, }, required: ["workspaceId", "userId"], },
- src/index.ts:357-368 (registration)The tool registration in the list of tools returned by ListToolsRequestSchema, including name, description, and input schema.name: "stop_time_entry", description: "Stop a running time entry", inputSchema: { type: "object", properties: { workspaceId: { type: "string", description: "Workspace ID" }, userId: { type: "string", description: "User ID" }, end: { type: "string", description: "End time (ISO 8601 format, optional - defaults to now)" }, }, required: ["workspaceId", "userId"], }, },
- src/index.ts:743-745 (registration)The switch case in the CallToolRequestSchema handler that validates parameters and dispatches to the stopTimeEntry handler method.case "stop_time_entry": if (!args?.workspaceId || !args?.userId) throw new McpError(ErrorCode.InvalidParams, 'workspaceId and userId are required'); return await this.stopTimeEntry(args as any);