Skip to main content
Glama
mikemc

Todoist MCP Server

by mikemc

todoist_add_section

Create and organize sections in Todoist projects by specifying name, project ID, and optional order. Simplify task management with structured project layouts.

Instructions

Create a new section in Todoist

Args: name: Section name project_id: Project ID this section should belong to order: Order among other sections in a project (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
orderNo
project_idYes

Implementation Reference

  • The handler function that implements the logic to add a new section to a Todoist project using the Todoist API client.
    def todoist_add_section(
        ctx: Context,
        name: str,
        project_id: str,
        order: Optional[int] = None
    ) -> str:
        """Create a new section in Todoist
    
        Args:
            name: Section name
            project_id: Project ID this section should belong to
            order: Order among other sections in a project (optional)
        """
        todoist_client = ctx.request_context.lifespan_context.todoist_client
    
        try:
            logger.info(f"Creating section '{name}' in project ID: {project_id}")
    
            section_params = {
                "name": name,
                "project_id": project_id
            }
    
            if order is not None:
                section_params["order"] = order
    
            section = todoist_client.add_section(**section_params)
    
            logger.info(f"Section created successfully: {section.id}")
            return json.dumps(section.to_dict(), indent=2, default=str)
        except Exception as error:
            logger.error(f"Error creating section: {error}")
            return f"Error creating section: {str(error)}"
  • src/main.py:80-80 (registration)
    The registration of the todoist_add_section tool using the MCP FastMCP tool decorator.
    mcp.tool()(todoist_add_section)
  • src/main.py:19-25 (registration)
    Import of the todoist_add_section handler function into main.py for registration.
    from .sections import (
        todoist_get_sections,
        todoist_get_section,
        todoist_add_section,
        todoist_update_section,
        todoist_delete_section,
    )

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