Skip to main content
Glama

assign_task

Use this tool to assign multiple users to a specific task in ClickUp. Input the task ID and user IDs to streamline task management and team collaboration.

Instructions

Assign users to a task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesTask ID
user_idsYesUser IDs to assign

Implementation Reference

  • The main handler function for the 'assign_task' tool. It resolves the task ID, creates an UpdateTaskRequest to add the specified user_ids to assignees, calls the ClickUp client to update the task, and returns success or error information.
    async def assign_task(self, task_id: str, user_ids: List[int]) -> Dict[str, Any]: """Assign users to task.""" try: # First resolve the task to get the internal ID resolved_task = await self._resolve_task_id(task_id) update_request = UpdateTaskRequest(assignees={"add": user_ids}) task = await self.client.update_task(resolved_task.id, update_request) except ClickUpAPIError as e: return {"error": f"Failed to assign users to task '{task_id}': {e!s}"} return { "task_id": task.id, "assignees": [u.username for u in task.assignees], "updated": True, }
  • The Tool schema definition for 'assign_task', including input schema with required properties task_id (string) and user_ids (array of integers).
    Tool( name="assign_task", description="Assign users to a task", inputSchema={ "type": "object", "properties": { "task_id": {"type": "string", "description": "Task ID"}, "user_ids": { "type": "array", "items": {"type": "integer"}, "description": "User IDs to assign", }, }, "required": ["task_id", "user_ids"], }, ),
  • Registration of all tools, including 'assign_task', mapping the tool name to its handler method in the ClickUpTools class __init__.
    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, }
  • Helper function _resolve_task_id used by the assign_task handler to convert input task_id (possibly custom or URL) to the internal ClickUp task ID.
    async def _resolve_task_id(self, task_id: str, include_subtasks: bool = False) -> Task: """Smart task ID resolution that handles both internal and custom IDs.""" # Parse task ID to determine if it might be a custom ID parsed_id, custom_type = parse_task_id(task_id, self.client.config.id_patterns) # Try direct lookup first (works for both internal and custom IDs) try: return await self.client.get_task(parsed_id, include_subtasks=include_subtasks) except ClickUpAPIError as direct_error: # If it might be a custom ID, try with custom_task_ids=true if custom_type or "-" in parsed_id: try: team_id = ( self.client.config.default_team_id or self.client.config.default_workspace_id ) return await self.client.get_task( parsed_id, include_subtasks=include_subtasks, custom_task_ids=True, team_id=team_id, ) except ClickUpAPIError as custom_error: # If both fail, try search as final fallback try: tasks = await self.client.search_tasks(query=task_id) if not tasks: raise ClickUpAPIError(f"Task '{task_id}' not found") # Find exact match by custom_id or use first result for task in tasks: if hasattr(task, "custom_id") and task.custom_id == task_id: return task return tasks[0] except ClickUpAPIError: # Re-raise the most relevant error raise (custom_error if custom_type else direct_error) from None else: # Not a custom ID pattern, re-raise the original error raise direct_error

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