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
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"project_id": {
"title": "Project Id",
"type": "string"
}
},
"required": [
"project_id"
],
"title": "todoist_delete_projectArguments",
"type": "object"
}
Implementation Reference
- src/projects.py:159-185 (handler)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)