todoist_delete_section
Delete a specific section in Todoist by providing its section ID. This tool integrates with the Todoist MCP Server to streamline task management directly through Claude’s interface.
Instructions
Deletes a section from Todoist
Args: section_id: ID of the section to delete
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| section_id | Yes |
Implementation Reference
- src/sections.py:126-151 (handler)The main execution logic for the todoist_delete_section tool. It retrieves the section by ID to confirm existence and get its name, then deletes it using the Todoist API client, with comprehensive logging and error handling.
def todoist_delete_section(ctx: Context, section_id: str) -> str: """Deletes a section from Todoist Args: section_id: ID of the section to delete """ todoist_client = ctx.request_context.lifespan_context.todoist_client try: logger.info(f"Deleting section with ID: {section_id}") try: section = todoist_client.get_section(section_id=section_id) section_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}. Deletion aborted." is_success = todoist_client.delete_section(section_id=section_id) logger.info(f"Section deleted successfully: {section_id}") return f"Successfully deleted section: {section_name} (ID: {section_id})" except Exception as error: logger.error(f"Error deleting section: {error}") return f"Error deleting section: {str(error)}" - src/main.py:82-82 (registration)Registers the todoist_delete_section handler function as an MCP tool using the FastMCP decorator.
mcp.tool()(todoist_delete_section)