todoist_update_project
Modify an existing Todoist project by updating its name, color, favorite status, or view style. Use this tool to keep your task management system organized and tailored to your preferences.
Instructions
Update an existing project in Todoist
Args: project_id: ID of the project to update name: New name for the project (optional) color: New color for the project (optional) is_favorite: Whether the project should be marked as favorite (optional) view_style: View style of the project, either 'list' or 'board' (optional)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | ||
| is_favorite | No | ||
| name | No | ||
| project_id | Yes | ||
| view_style | No |
Input Schema (JSON Schema)
{
"properties": {
"color": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Color"
},
"is_favorite": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"title": "Is Favorite"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"project_id": {
"title": "Project Id",
"type": "string"
},
"view_style": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "View Style"
}
},
"required": [
"project_id"
],
"title": "todoist_update_projectArguments",
"type": "object"
}
Implementation Reference
- src/projects.py:106-157 (handler)The handler function that implements the logic to update a Todoist project. It fetches the project, builds update parameters from inputs, and calls the Todoist API to update.def todoist_update_project( ctx: Context, project_id: str, name: Optional[str] = None, color: Optional[str] = None, is_favorite: Optional[bool] = None, view_style: Optional[str] = None ) -> str: """Update an existing project in Todoist Args: project_id: ID of the project to update name: New name for the project (optional) color: New color for the project (optional) is_favorite: Whether the project should be marked as favorite (optional) view_style: View style of the project, either 'list', 'board', or 'calendar' (optional) """ todoist_client = ctx.request_context.lifespan_context.todoist_client try: logger.info(f"Updating project with ID: {project_id}") # Pre-fetch for validation and meaningful error messages try: project = todoist_client.get_project(project_id=project_id) original_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}. Update aborted." update_params = {} if name: update_params["name"] = name if color: update_params["color"] = color if is_favorite is not None: update_params["is_favorite"] = is_favorite # Same validation as create to maintain consistency if view_style and view_style in ["list", "board", "calendar"]: update_params["view_style"] = view_style if len(update_params) == 0: return f"No update parameters provided for project: {original_name} (ID: {project_id})" updated_project = todoist_client.update_project(project_id, **update_params) logger.info(f"Project updated successfully: {project_id}") return json.dumps(updated_project.to_dict(), indent=2, default=str) except Exception as error: logger.error(f"Error updating project: {error}") return f"Error updating project: {str(error)}"
- src/main.py:75-75 (registration)Registration of the todoist_update_project tool using the MCP FastMCP tool decorator.mcp.tool()(todoist_update_project)
- src/projects.py:106-122 (schema)Function signature and docstring defining the input schema (parameters and descriptions) for the tool.def todoist_update_project( ctx: Context, project_id: str, name: Optional[str] = None, color: Optional[str] = None, is_favorite: Optional[bool] = None, view_style: Optional[str] = None ) -> str: """Update an existing project in Todoist Args: project_id: ID of the project to update name: New name for the project (optional) color: New color for the project (optional) is_favorite: Whether the project should be marked as favorite (optional) view_style: View style of the project, either 'list', 'board', or 'calendar' (optional) """
- src/main.py:12-18 (registration)Import statement bringing the todoist_update_project handler into main.py for registration.from .projects import ( todoist_get_projects, todoist_get_project, todoist_add_project, todoist_update_project, todoist_delete_project, )