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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| section_id | Yes |
Implementation Reference
- src/sections.py:97-124 (handler)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)