Skip to main content
Glama
mikemc

Todoist MCP Server

by mikemc

todoist_add_project

Add a new project to Todoist with customizable options such as name, color, parent project ID, favorite status, and view style for better task organization and management.

Instructions

Create a new project in Todoist

Args: name: Name of the project color: Color of the project (optional) parent_id: ID of the parent project for creating sub-projects (optional) is_favorite: Whether the project should be marked as favorite (optional) view_style: View style of the project, either 'list' or 'board' (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
colorNo
is_favoriteNo
nameYes
parent_idNo
view_styleNo

Implementation Reference

  • The main handler function that implements the logic for adding a new Todoist project using the Todoist API, including parameter validation and error handling.
    def todoist_add_project(
        ctx: Context,
        name: str,
        color: Optional[str] = None,
        parent_id: Optional[str] = None,
        is_favorite: Optional[bool] = None,
        view_style: Optional[str] = None
    ) -> str:
        """Create a new project in Todoist
    
        Args:
            name: Name of the project
            color: Color of the project (optional)
            parent_id: ID of the parent project for creating sub-projects (optional)
            is_favorite: Whether the project should be marked as favorite (optional)
            view_style: View style of the project, either 'list' or 'board' (optional)
        """
        todoist_client = ctx.request_context.lifespan_context.todoist_client
    
        try:
            logger.info(f"Creating project: {name}")
    
            project_params = {
                "name": name
            }
    
            # Add optional parameters efficiently
            if color:
                project_params["color"] = color
            if parent_id:
                project_params["parent_id"] = parent_id
            if is_favorite is not None:
                project_params["is_favorite"] = is_favorite
            # Validate view_style against API-supported values to prevent errors
            if view_style and view_style in ["list", "board", "calendar"]:
                project_params["view_style"] = view_style
    
            project = todoist_client.add_project(**project_params)
    
            logger.info(f"Project created successfully: {project.id}")
            return json.dumps(project.to_dict(), indent=2, default=str)
        except Exception as error:
            logger.error(f"Error creating project: {error}")
            return f"Error creating project: {str(error)}"
  • src/main.py:74-74 (registration)
    Registers the todoist_add_project function as an MCP tool using the FastMCP tool decorator.
    mcp.tool()(todoist_add_project)
  • src/main.py:12-18 (registration)
    Imports the todoist_add_project handler from the projects module for use in the MCP server.
    from .projects import (
        todoist_get_projects,
        todoist_get_project,
        todoist_add_project,
        todoist_update_project,
        todoist_delete_project,
    )

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/mikemc/todoist-mcp-server'

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