Skip to main content
Glama
Johnxjp

Todoist Python MCP Server

by Johnxjp

create_task

Add a new task to Todoist with customizable details including content, description, project ID, labels, priority, due date, and section ID for efficient task management.

Instructions

Create a new task Args: - content [str]: Task content. This value may contain markdown-formatted text and hyperlinks. Details on markdown support can be found in the Text Formatting article in the Help Center. - description [str]: A description for the task. This value may contain markdown-formatted text and hyperlinks. Details on markdown support can be found in the Text Formatting article in the Help Center. - project_id [str]: The ID of the project to add the task. If none, adds to user's inbox by default. - labels [list[str]]: The task's labels (a list of names that may represent either personal or shared labels). - priority [int]: Task priority from 1 (normal) to 4 (urgent). - due_date [str]: Specific date in YYYY-MM-DD format relative to user’s timezone. - section_id [str]: The ID of the section to add the task to Returns: - task_id: str:

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes
descriptionNo
due_dateNo
labelsNo
priorityNo
project_idNo
section_idNo

Implementation Reference

  • The `create_task` function is the main handler for the MCP tool. It is decorated with `@mcp.tool()` which registers it as a tool. The function signature defines the input schema (parameters like content, project_id, etc.), and the docstring provides detailed descriptions. The body constructs a data dict from optional params and calls `todoist_api.add_task` to create the task, returning the new task ID.
    @mcp.tool() def create_task( content: str, description: Optional[str] = None, project_id: Optional[str] = None, labels: Optional[list[str]] = None, priority: Optional[int] = None, due_date: Optional[str] = None, section_id: Optional[str] = None, ) -> str: """ Create a new task Args: - content [str]: Task content. This value may contain markdown-formatted text and hyperlinks. Details on markdown support can be found in the Text Formatting article in the Help Center. - description [str]: A description for the task. This value may contain markdown-formatted text and hyperlinks. Details on markdown support can be found in the Text Formatting article in the Help Center. - project_id [str]: The ID of the project to add the task. If none, adds to user's inbox by default. - labels [list[str]]: The task's labels (a list of names that may represent either personal or shared labels). - priority [int]: Task priority from 1 (normal) to 4 (urgent). - due_date [str]: Specific date in YYYY-MM-DD format relative to user’s timezone. - section_id [str]: The ID of the section to add the task to Returns: - task_id: str: """ try: data = {} if description: data["description"] = description if project_id: data["project_id"] = project_id if labels: if isinstance(labels, str): labels = [labels] data["labels"] = labels if priority: data["priority"] = priority if due_date: data["due_date"] = due_date if section_id: data["section_id"] = section_id task = todoist_api.add_task(content, **data) return task.id except Exception as e: raise Exception(f"Couldn't create task {str(e)}")
  • The function signature provides the input schema for the `create_task` tool, specifying required (content) and optional parameters with types.
    def create_task( content: str, description: Optional[str] = None, project_id: Optional[str] = None, labels: Optional[list[str]] = None, priority: Optional[int] = None, due_date: Optional[str] = None, section_id: Optional[str] = None, ) -> str:
  • The `@mcp.tool()` decorator registers the `create_task` function as an MCP tool.
    @mcp.tool()

Other Tools

Related Tools

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/Johnxjp/todoist-mcp-python'

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