Skip to main content
Glama
lists.py7.37 kB
from typing import List, Dict, Any from mcp.types import Tool, TextContent import json class ListTools: """List management tools for ClickUp MCP""" def __init__(self, client): self.client = client def get_tools(self) -> List[Tool]: """Get all list-related tools""" return [ Tool( name="get_lists", description="Get all lists in a space", inputSchema={ "type": "object", "properties": { "space_id": { "type": "string", "description": "The ID of the space" } }, "required": ["space_id"] } ), Tool( name="create_list", description="Create a new list in a space", inputSchema={ "type": "object", "properties": { "space_id": { "type": "string", "description": "The ID of the space to create the list in" }, "name": { "type": "string", "description": "The name of the list" }, "content": { "type": "string", "description": "Description of the list (optional)" }, "due_date": { "type": "string", "description": "Due date for the list in Unix timestamp milliseconds (optional)" }, "due_date_time": { "type": "boolean", "description": "Whether the due date should include time (optional)" }, "priority": { "type": "integer", "description": "Priority level (1=urgent, 2=high, 3=normal, 4=low, optional)" }, "assignee": { "type": "string", "description": "User ID to assign the list to (optional)" }, "status": { "type": "string", "description": "Initial status for tasks in this list (optional)" } }, "required": ["space_id", "name"] } ), Tool( name="update_list", description="Update an existing list", inputSchema={ "type": "object", "properties": { "list_id": { "type": "string", "description": "The ID of the list to update" }, "name": { "type": "string", "description": "New name of the list (optional)" }, "content": { "type": "string", "description": "New description of the list (optional)" }, "due_date": { "type": "string", "description": "New due date in Unix timestamp milliseconds (optional)" }, "due_date_time": { "type": "boolean", "description": "Whether the due date should include time (optional)" }, "priority": { "type": "integer", "description": "New priority level (1=urgent, 2=high, 3=normal, 4=low, optional)" }, "assignee": { "type": "string", "description": "New user ID to assign the list to (optional)" }, "unset_status": { "type": "boolean", "description": "Whether to unset the status (optional)" } }, "required": ["list_id"] } ), Tool( name="delete_list", description="Delete a list", inputSchema={ "type": "object", "properties": { "list_id": { "type": "string", "description": "The ID of the list to delete" } }, "required": ["list_id"] } ) ] async def handle_tool_call(self, name: str, arguments: Dict[str, Any]) -> List[TextContent]: """Handle list tool calls""" try: if name == "get_lists": result = await self._get_lists(arguments) elif name == "create_list": result = await self._create_list(arguments) elif name == "update_list": result = await self._update_list(arguments) elif name == "delete_list": result = await self._delete_list(arguments) else: raise ValueError(f"Unknown tool: {name}") return [TextContent(type="text", text=json.dumps(result, indent=2))] except Exception as e: return [TextContent(type="text", text=f"Error: {str(e)}")] async def _get_lists(self, args: Dict[str, Any]) -> Dict[str, Any]: """Get lists in a space""" space_id = args["space_id"] lists = self.client.get_lists(space_id) return {"lists": lists, "count": len(lists), "space_id": space_id} async def _create_list(self, args: Dict[str, Any]) -> Dict[str, Any]: """Create a new list""" space_id = args["space_id"] list_data = {"name": args["name"]} optional_fields = [ "content", "due_date", "due_date_time", "priority", "assignee", "status" ] for field in optional_fields: if field in args: list_data[field] = args[field] return self.client.create_list(space_id, list_data) async def _update_list(self, args: Dict[str, Any]) -> Dict[str, Any]: """Update a list""" list_id = args["list_id"] list_data = {} optional_fields = [ "name", "content", "due_date", "due_date_time", "priority", "assignee", "unset_status" ] for field in optional_fields: if field in args: list_data[field] = args[field] return self.client.update_list(list_id, list_data) async def _delete_list(self, args: Dict[str, Any]) -> Dict[str, Any]: """Delete a list""" list_id = args["list_id"] return self.client.delete_list(list_id)

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

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