Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYes
titleNo
descriptionNo
statusNo

Implementation Reference

  • 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__)
  • 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)
  • Registers the update_task_tool (along with other task tools) on the FastMCP server instance.
    create_tasks_tools(mcp)

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/chipocrudos/tasks-mcp'

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