get_subtasks
Retrieve all subtasks associated with a parent task in ClickUp to manage project workflows and track task dependencies.
Instructions
Get all subtasks of a parent task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parent_task_id | Yes | Parent task ID |
Implementation Reference
- src/clickup_mcp/tools.py:793-818 (handler)MCP tool handler for 'get_subtasks'. Resolves parent task ID, fetches subtasks via client, and formats the response dictionary.async def get_subtasks(self, parent_task_id: str) -> Dict[str, Any]: """Get subtasks of a parent task.""" try: # First resolve the task to get the internal ID task = await self._resolve_task_id(parent_task_id) # Use the client's proper subtasks method subtasks = await self.client.get_subtasks(task.id) return { "parent_id": task.id, "subtasks": [ { "id": task.id, "name": task.name, "status": task.status.status, "assignees": [u.username for u in task.assignees], "url": format_task_url(task.id), "custom_id": task.custom_id if task.custom_id else None, } for task in subtasks ], "count": len(subtasks), } except Exception as e: return {"error": f"Failed to get subtasks for '{parent_task_id}': {e!s}"}
- src/clickup_mcp/tools.py:197-207 (schema)JSON Schema definition for the input parameters of the 'get_subtasks' tool.Tool( name="get_subtasks", description="Get all subtasks of a parent task", inputSchema={ "type": "object", "properties": { "parent_task_id": {"type": "string", "description": "Parent task ID"}, }, "required": ["parent_task_id"], }, ),
- src/clickup_mcp/tools.py:23-57 (registration)Registration of the 'get_subtasks' handler method in the tools dispatch dictionary used by call_tool.self._tools: Dict[str, Callable] = { "create_task": self.create_task, "get_task": self.get_task, "update_task": self.update_task, "delete_task": self.delete_task, "list_tasks": self.list_tasks, "search_tasks": self.search_tasks, "get_subtasks": self.get_subtasks, "get_task_comments": self.get_task_comments, "create_task_comment": self.create_task_comment, "get_task_status": self.get_task_status, "update_task_status": self.update_task_status, "get_assignees": self.get_assignees, "assign_task": self.assign_task, "list_spaces": self.list_spaces, "list_folders": self.list_folders, "list_lists": self.list_lists, "find_list_by_name": self.find_list_by_name, # Bulk operations "bulk_update_tasks": self.bulk_update_tasks, "bulk_move_tasks": self.bulk_move_tasks, # Time tracking "get_time_tracked": self.get_time_tracked, "log_time": self.log_time, # Templates "create_task_from_template": self.create_task_from_template, "create_task_chain": self.create_task_chain, # Analytics "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, }
- src/clickup_mcp/client.py:438-462 (helper)Helper method in ClickUpClient that performs the actual API call to retrieve subtasks using the team/task endpoint with parent filter.async def get_subtasks(self, parent_task_id: str) -> List[Task]: """Get subtasks of a parent task using team endpoint.""" # Get the workspace ID - use configured default or fetch from API workspace_id = self.config.default_workspace_id if not workspace_id: workspaces = await self.get_workspaces() if not workspaces: return [] workspace_id = workspaces[0].id # Use team endpoint to get tasks with parent filter params = { "parent": parent_task_id, "include_closed": "true", } try: data = await self._request("GET", f"/team/{workspace_id}/task", params=params) tasks_data = data.get("tasks", []) return [Task(**task_data) for task_data in tasks_data] except ClickUpAPIError as e: # If team endpoint fails, fallback to original method logger.warning(f"Team endpoint failed for subtasks: {e}") return []