Skip to main content
Glama

add_task_tool

Create a new task with a title and optional description to organize your workflow using the Tasks MCP Server.

Instructions

Add a new task. Args: title (str): The title of the task. description (str): The description of the task. optional value.

Returns: Task: The newly created task object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes
descriptionNo

Implementation Reference

  • The async handler function implementing the 'add_task_tool' logic: retrieves database from context, adds task with title and optional description (normalized to empty string if None), and returns the created Task instance.
    @mcp.tool() async def add_task_tool( ctx: Context[ServerSession, AppContext], title: str, description: str | None = None, ) -> Task: """Add a new task. Args: title (str): The title of the task. description (str): The description of the task. optional value. Returns: Task: The newly created task object. """ database: DatabaseABC = ctx.request_context.lifespan_context.db # Normalize None to empty string for storage compatibility task = database.add_task(title=title, description=description or "") return Task(**task.__dict__)
  • Pydantic BaseModel defining the Task structure, used as the return type for add_task_tool and for serializing database task objects.
    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)
  • Invocation of create_tasks_tools(mcp) within the MCP server creation, which defines and registers the add_task_tool (via @mcp.tool() decorator inside create_tasks_tools) along with other task tools.
    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