Skip to main content
Glama

TodoWrite

Replace your entire todo list with updated tasks, maintaining task IDs, content, status, priority, and metadata for persistent project management.

Instructions

Update the entire task list (complete replacement).

Parameters: todos: List of todo items, each containing: - id: Unique identifier for the task - content: Task description - status: Current status (pending, in_progress, completed) - priority: Task priority (high, medium, low) - metadata: Optional additional data

Returns success status and count of todos written.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
todosYes

Implementation Reference

  • Core handler function `todo_write` that performs validation on input parameters and writes the todos list to the persistent store using `store.write_todos`. This contains the primary execution logic for the TodoWrite tool.
    async def todo_write(params: TodoWriteParams) -> TodoWriteResponse:
        """
        Update the entire task list (complete replacement).
    
        Parameters:
            params: Dictionary containing 'todos' list
    
        Returns:
            TodoWriteResponse with success status and todo count
    
        Raises:
            ValidationError: If todos fail validation
        """
        # Validate params structure
        if not isinstance(params, dict):
            raise ValidationError("Parameters must be a dictionary")
    
        if "todos" not in params:
            raise ValidationError("Missing required field: todos")
    
        todos = params["todos"]
    
        try:
            # Write todos (validation happens inside)
            count = await store.write_todos(todos)
    
            return {"success": True, "count": count}
        except ValidationError:
            # Re-raise validation errors
            raise
        except Exception as e:
            # Wrap other errors
            raise ValidationError(f"Failed to write todos: {str(e)}")
  • src/server.py:62-88 (registration)
    MCP tool registration and wrapper handler for `TodoWrite`. Decorated with `@mcp.tool` and delegates to the core `todo_write` function while handling errors.
    @mcp.tool
    async def TodoWrite(todos: list[dict[str, Any]]) -> dict[str, Any]:
        """
        Update the entire task list (complete replacement).
    
        Parameters:
            todos: List of todo items, each containing:
                - id: Unique identifier for the task
                - content: Task description
                - status: Current status (pending, in_progress, completed)
                - priority: Task priority (high, medium, low)
                - metadata: Optional additional data
    
        Returns success status and count of todos written.
        """
        try:
            return await todo_write({"todos": todos})
        except ValidationError as e:
            return {"error": {"code": "VALIDATION_ERROR", "message": str(e)}}
        except Exception as e:
            return {
                "error": {
                    "code": "WRITE_ERROR",
                    "message": f"Failed to write todos: {str(e)}",
                }
            }
  • Type definitions (schemas) for `TodoWriteParams` input and `TodoWriteResponse` output used in the tool implementation.
    class TodoWriteParams(TypedDict):
        todos: list[dict[str, Any]]
    
    
    class TodoWriteResponse(TypedDict):
        success: bool
        count: int
Install Server

Other Tools

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/joehaddad2000/claude-todo-emulator'

If you have feedback or need assistance with the MCP directory API, please join our Discord server