Skip to main content
Glama
DiversioTeam

ClickUp MCP Server

by DiversioTeam

create_task_from_template

Create ClickUp tasks using predefined templates to standardize workflows and reduce manual setup time. Customize templates with specific details and assign them to project lists.

Instructions

Create a task from a template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_nameYesTemplate name
customizationsNoCustomizations to apply to template
list_idYesList ID for the new task

Implementation Reference

  • Implements the core logic for creating a task from predefined templates (bug_report, feature_request, code_review), applying customizations, and using the ClickUpClient to create the task.
    async def create_task_from_template(
        self,
        template_name: str,
        list_id: str,
        customizations: Optional[Dict[str, Any]] = None,
    ) -> Dict[str, Any]:
        """Create a task from a template."""
        # Define common templates
        templates = {
            "bug_report": {
                "name": "Bug Report: {title}",
                "description": "## Description\n\n## Steps to Reproduce\n1. \n2. \n3. \n\n## Expected Behavior\n\n## Actual Behavior\n\n## Environment\n",
                "priority": 2,
                "tags": ["bug"],
            },
            "feature_request": {
                "name": "Feature: {title}",
                "description": "## Feature Description\n\n## User Story\nAs a [user type], I want [goal] so that [benefit].\n\n## Acceptance Criteria\n- [ ] \n- [ ] \n\n## Technical Notes\n",
                "priority": 3,
                "tags": ["feature"],
            },
            "code_review": {
                "name": "Code Review: {title}",
                "description": "## PR Link\n\n## Changes Summary\n\n## Checklist\n- [ ] Code follows style guidelines\n- [ ] Tests added/updated\n- [ ] Documentation updated\n- [ ] No console errors\n",
                "priority": 2,
                "tags": ["review"],
            },
        }
    
        template = templates.get(template_name)
        if not template:
            return {"error": f"Template '{template_name}' not found"}
    
        # Apply customizations
        task_data = template.copy()
        if customizations:
            task_data["name"] = task_data["name"].format(**customizations)
            task_data.update(customizations)
    
        # Create task
        task_request = CreateTaskRequest(
            name=task_data["name"],
            description=task_data.get("description"),
            priority=task_data.get("priority"),
            tags=task_data.get("tags"),
        )
    
        task = await self.client.create_task(list_id, task_request)
    
        return {
            "id": task.id,
            "name": task.name,
            "template": template_name,
            "url": format_task_url(task.id),
        }
  • Defines the input schema and metadata for the create_task_from_template tool.
        name="create_task_from_template",
        description="Create a task from a template",
        inputSchema={
            "type": "object",
            "properties": {
                "template_name": {"type": "string", "description": "Template name"},
                "customizations": {
                    "type": "object",
                    "description": "Customizations to apply to template",
                },
                "list_id": {"type": "string", "description": "List ID for the new task"},
            },
            "required": ["template_name", "list_id"],
        },
    ),
  • Registers the create_task_from_template tool in the ClickUpTools class's _tools dictionary, mapping the tool name to its handler method.
    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,
    }
  • Registers the MCP list_tools handler which returns definitions including create_task_from_template via ClickUpTools.get_tool_definitions().
    @self.server.list_tools()
    async def list_tools() -> List[Tool]:
        """List all available tools."""
        return self.tools.get_tool_definitions()
  • Registers the MCP call_tool handler which dispatches to ClickUpTools.call_tool, enabling execution of create_task_from_template.
    @self.server.call_tool()
    async def call_tool(
        name: str, arguments: Optional[Dict[str, Any]] = None
    ) -> List[TextContent | ImageContent | EmbeddedResource]:
        """Call a specific tool."""
        logger.debug(f"Calling tool: {name} with arguments: {arguments}")
    
        try:
            result = await self.tools.call_tool(name, arguments or {})
            return [TextContent(type="text", text=result)]
        except Exception as e:
            logger.error(f"Error calling tool {name}: {e}", exc_info=True)
            return [TextContent(type="text", text=f"Error: {e!s}")]

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