get_time_tracked
Retrieve tracked time data for tasks within a specified date range to analyze team productivity and project progress in ClickUp.
Instructions
Get time tracked for tasks
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_time_tracked"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | No | User ID | |
| start_date | No | Start date (ISO 8601) | |
| end_date | No | End date (ISO 8601) |
Implementation Reference
- src/clickup_mcp/tools.py:1072-1116 (handler)The main handler function for the 'get_time_tracked' tool. It retrieves time entries from the ClickUp API for a given user and date range (defaulting to last 7 days), calculates total time in ms and hours, and returns a summary.
async def get_time_tracked( self, user_id: Optional[int] = None, start_date: Optional[str] = None, end_date: Optional[str] = None, ) -> Dict[str, Any]: """Get time tracked for tasks.""" # If no dates provided, default to last 7 days if not start_date: start_date = (datetime.now() - timedelta(days=7)).isoformat() if not end_date: end_date = datetime.now().isoformat() start_ts = int(datetime.fromisoformat(start_date.replace("Z", "+00:00")).timestamp() * 1000) end_ts = int(datetime.fromisoformat(end_date.replace("Z", "+00:00")).timestamp() * 1000) # Get time entries params = { "start_date": str(start_ts), "end_date": str(end_ts), } if user_id: params["assignee"] = str(user_id) workspace_id = self.client.config.default_workspace_id if not workspace_id: workspaces = await self.client.get_workspaces() workspace_id = workspaces[0].id data = await self.client._request( "GET", f"/team/{workspace_id}/time_entries", params=params ) total_ms = sum(entry.get("duration", 0) for entry in data.get("data", [])) total_hours = total_ms / (1000 * 60 * 60) return { "total_milliseconds": total_ms, "total_hours": round(total_hours, 2), "entries": len(data.get("data", [])), "period": { "start": start_date, "end": end_date, }, } - src/clickup_mcp/tools.py:368-380 (schema)The Tool schema definition for 'get_time_tracked', specifying input parameters: optional user_id, start_date, end_date as strings in ISO 8601 format.
Tool( name="get_time_tracked", description="Get time tracked for tasks", inputSchema={ "type": "object", "properties": { "user_id": {"type": "integer", "description": "User ID"}, "start_date": {"type": "string", "description": "Start date (ISO 8601)"}, "end_date": {"type": "string", "description": "End date (ISO 8601)"}, }, }, ), Tool( - src/clickup_mcp/tools.py:45-45 (registration)Registration of the 'get_time_tracked' tool name mapped to its handler method in the ClickUpTools class _tools dictionary.
"get_time_tracked": self.get_time_tracked,