Skip to main content
Glama
mikemc

Todoist MCP Server

by mikemc

todoist_delete_project

Removes a specific project from your Todoist account using the project ID. Streamlines project management by enabling quick deletion of unnecessary or completed projects.

Instructions

Deletes a project from the user's Todoist account

Args: project_id: ID of the project to delete

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Implementation Reference

  • The handler function that implements the logic to delete a Todoist project by its ID. It retrieves the project for confirmation, calls the Todoist API to delete it, and returns a success message with the project name or an error.
    def todoist_delete_project(ctx: Context, project_id: str) -> str:
        """Deletes a project from the user's Todoist account
    
        Args:
            project_id: ID of the project to delete
        """
        todoist_client = ctx.request_context.lifespan_context.todoist_client
    
        try:
            logger.info(f"Deleting project with ID: {project_id}")
    
            # Capture project name for meaningful success/failure messages
            try:
                project = todoist_client.get_project(project_id=project_id)
                project_name = project.name
            except Exception as error:
                logger.warning(f"Error getting project with ID: {project_id}: {error}")
                return f"Could not verify project with ID: {project_id}. Deletion aborted."
    
            is_success = todoist_client.delete_project(project_id=project_id)
    
            logger.info(f"Project deleted successfully: {project_id} ({project_name})")
            return f"Successfully deleted project: {project_name} (ID: {project_id})"
    
        except Exception as error:
            logger.error(f"Error deleting project: {error}")
            return f"Error deleting project: {str(error)}"
  • src/main.py:76-76 (registration)
    Registers the todoist_delete_project function as an MCP tool using the FastMCP decorator.
    mcp.tool()(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