Skip to main content
Glama

create_task

Add new tasks to Todoist with content, due dates, priorities, labels, and project organization to manage your to-do list effectively.

Instructions

Create a new task in Todoist.

Args: content: The task content/title description: Detailed description of the task project_id: Project ID to add the task to section_id: Section ID within the project parent_id: Parent task ID (for subtasks) labels: List of label names priority: Priority from 1 (normal) to 4 (urgent) due_string: Human readable due date (e.g., 'tomorrow', 'next Monday') due_date: ISO 8601 formatted due date

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes
descriptionNo
project_idNo
section_idNo
parent_idNo
labelsNo
priorityNo
due_stringNo
due_dateNo

Implementation Reference

  • MCP tool handler for 'create_task'. This function defines the tool logic, input schema via type annotations and docstring, and is registered via @mcp.tool() decorator. It calls the TodoistClient to create the task and returns formatted response.
    @mcp.tool() async def create_task( content: str, description: str = "", project_id: Optional[str] = None, section_id: Optional[str] = None, parent_id: Optional[str] = None, labels: Optional[List[str]] = None, priority: int = 1, due_string: Optional[str] = None, due_date: Optional[str] = None ) -> str: """Create a new task in Todoist. Args: content: The task content/title description: Detailed description of the task project_id: Project ID to add the task to section_id: Section ID within the project parent_id: Parent task ID (for subtasks) labels: List of label names priority: Priority from 1 (normal) to 4 (urgent) due_string: Human readable due date (e.g., 'tomorrow', 'next Monday') due_date: ISO 8601 formatted due date """ _check_client() task = await todoist_client.create_task( content=content, description=description, project_id=project_id, section_id=section_id, parent_id=parent_id, labels=labels or [], priority=priority, due_string=due_string, due_date=due_date ) return ( f"Task created successfully!\n" f"ID: {task.id}\n" f"Title: {task.content}\n" f"URL: {task.url}" )
  • The @mcp.tool() decorator registers the create_task function as an MCP tool.
    @mcp.tool()
  • TodoistClient helper method that makes the actual POST request to Todoist API to create a task.
    async def create_task(self, content: str, description: str = "", project_id: Optional[str] = None, section_id: Optional[str] = None, parent_id: Optional[str] = None, order: Optional[int] = None, labels: Optional[List[str]] = None, priority: int = 1, due_string: Optional[str] = None, due_date: Optional[str] = None) -> TodoistTask: """Create a new task.""" payload = { "content": content, "description": description, "priority": priority } if project_id: payload["project_id"] = project_id if section_id: payload["section_id"] = section_id if parent_id: payload["parent_id"] = parent_id if order is not None: payload["order"] = order if labels: payload["labels"] = labels if due_string: payload["due_string"] = due_string if due_date: payload["due_date"] = due_date data = await self._request("POST", "/tasks", json=payload) return TodoistTask(**data)
  • Pydantic model defining the structure of a Todoist task, used by the client to parse API responses.
    class TodoistTask(BaseModel): """Represents a Todoist task.""" id: str content: str description: str = "" is_completed: bool = False labels: List[str] = [] priority: int = 1 due_string: Optional[str] = None due_date: Optional[str] = None project_id: str = "" section_id: Optional[str] = None parent_id: Optional[str] = None order: int = 0 url: str = "" created_at: str = ""

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/dan-bailey/todoist-mcp'

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