Skip to main content
Glama
mikemc

Todoist MCP Server

by mikemc

todoist_update_section

Modify the name of a specific section in Todoist by providing its ID and the updated section name for better task organization.

Instructions

Updates a section in Todoist

Args: section_id: ID of the section to update name: New name for the section

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
section_idYes

Implementation Reference

  • The main handler function for the todoist_update_section tool. It updates a Todoist section's name using the Todoist API client from the context, handles errors, and returns the updated section as JSON.
    def todoist_update_section(ctx: Context, section_id: str, name: str) -> str:
        """Updates a section in Todoist
    
        Args:
            section_id: ID of the section to update
            name: New name for the section
        """
        todoist_client = ctx.request_context.lifespan_context.todoist_client
    
        try:
            logger.info(f"Updating section with ID: {section_id}")
    
            # Capture original name for informative response messages
            try:
                section = todoist_client.get_section(section_id=section_id)
                original_name = section.name
            except Exception as error:
                logger.warning(f"Error getting section with ID: {section_id}: {error}")
                return f"Could not verify section with ID: {section_id}. Update aborted."
    
            updated_section = todoist_client.update_section(section_id=section_id, name=name)
    
            logger.info(f"Section updated successfully: {section_id}")
            return json.dumps(updated_section.to_dict(), indent=2, default=str)
    
        except Exception as error:
            logger.error(f"Error updating section: {error}")
            return f"Error updating section: {str(error)}"
  • src/main.py:81-81 (registration)
    Registers the todoist_update_section function as an MCP tool using the FastMCP decorator.
    mcp.tool()(todoist_update_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