update_task_tool
Modify existing tasks by updating their title, description, or status using the task ID to manage and organize your workflow.
Instructions
Update an existing task. Args: task (Task): The task object containing updated information.
Returns: Task: The updated task object.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| title | No | ||
| description | No | ||
| status | No |
Implementation Reference
- src/tools/tasks.py:59-92 (handler)The core handler function for the 'update_task_tool' that performs the task update logic using the database interface.@mcp.tool() async def update_task_tool( ctx: Context[ServerSession, AppContext], id: int, title: str | None = None, description: str | None = None, status: TaskStatus | None = None, ) -> Task: """Update an existing task. Args: task (Task): The task object containing updated information. Returns: Task: The updated task object. """ database: DatabaseABC = ctx.request_context.lifespan_context.db task = database.get_task(task_id=id) if title is None or title == "": title = task.title if description is None or description == "": description = task.description if status is None: status = task.status task = database.update_task( task_id=id, title=title, description=description, status=status, ) return Task(**task.__dict__)
- src/models/tasks.py:6-18 (schema)Pydantic models for Task and TaskStatus used for type definitions, validation, and serialization in the tool's input/output.class TaskStatus(IntEnum): CREATED = 0 IN_PROGRESS = 1 COMPLETED = 2 class Task(BaseModel): id: int = Field(default=None) title: str = Field(..., description="The title of the task") description: str = Field(default="", description="The description of the task") status: TaskStatus = TaskStatus.CREATED created_at: str = Field(default=None)
- src/config/server.py:35-35 (registration)Registers the update_task_tool (along with other task tools) on the FastMCP server instance.create_tasks_tools(mcp)