Skip to main content
Glama

get_task_analytics

Analyze task performance metrics like velocity and completion rate in ClickUp. Provide Space ID and period to evaluate productivity trends and workflow efficiency.

Instructions

Get analytics for tasks (velocity, completion rate, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
period_daysNoPeriod in days to analyze
space_idYesSpace ID

Implementation Reference

  • Registration of the get_task_analytics handler in the internal _tools dictionary of ClickUpTools class, mapping the tool name to its implementation method.
    "get_team_workload": self.get_team_workload, "get_task_analytics": self.get_task_analytics, # User management "list_users": self.list_users, "get_current_user": self.get_current_user, "find_user_by_name": self.find_user_by_name, }
  • MCP Tool schema definition including input schema for space_id (required) and period_days (optional).
    Tool( name="get_task_analytics", description="Get analytics for tasks (velocity, completion rate, etc.)", inputSchema={ "type": "object", "properties": { "space_id": {"type": "string", "description": "Space ID"}, "period_days": { "type": "integer", "description": "Period in days to analyze", }, }, "required": ["space_id"], }, ),
  • Core implementation of get_task_analytics: fetches tasks created in the given period using client.search_tasks, computes completion rate, average completion hours, tasks per day, and priority distribution.
    async def get_task_analytics(self, space_id: str, period_days: int = 30) -> Dict[str, Any]: """Get analytics for tasks.""" # Calculate date range end_date = datetime.now() start_date = end_date - timedelta(days=period_days) # Get tasks created in period tasks = await self.client.search_tasks( query="", date_created_gt=int(start_date.timestamp() * 1000), date_created_lt=int(end_date.timestamp() * 1000), ) # Calculate metrics total_tasks = len(tasks) completed_tasks = sum(1 for task in tasks if task.status.type == "closed") # Calculate average completion time completion_times = [] for task in tasks: if task.date_closed and task.date_created: time_to_complete = (task.date_closed - task.date_created).total_seconds() / 3600 completion_times.append(time_to_complete) avg_completion_time = ( sum(completion_times) / len(completion_times) if completion_times else 0 ) # Tasks by priority by_priority = {1: 0, 2: 0, 3: 0, 4: 0} for task in tasks: if task.priority: by_priority[task.priority.value] += 1 return { "space_id": space_id, "period_days": period_days, "metrics": { "total_tasks_created": total_tasks, "completed_tasks": completed_tasks, "completion_rate": round( completed_tasks / total_tasks * 100 if total_tasks > 0 else 0, 2 ), "avg_completion_hours": round(avg_completion_time, 2), "tasks_per_day": round(total_tasks / period_days, 2), }, "by_priority": by_priority, }
  • Instantiation of ClickUpTools in the MCP server, which includes the get_task_analytics tool.
    self.client = ClickUpClient(config) self.tools = ClickUpTools(self.client)

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