Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idNoUser ID
start_dateNoStart date (ISO 8601)
end_dateNoEnd date (ISO 8601)

Implementation Reference

  • 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, }, }
  • 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(
  • 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,

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/DiversioTeam/clickup-mcp'

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