Skip to main content
Glama

tasks_list_tool

Retrieve and display a specified number of tasks from the task management system to review current items and track progress.

Instructions

Get a list of tasks. Args: task_limit (int): The maximum number of tasks to return. Default is 10.

Returns: list[Task]: A list of tasks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_limitNo

Implementation Reference

  • The core handler function for the 'tasks_list_tool' that executes the logic to fetch and return a list of tasks from the database, limited by task_limit.
    @mcp.tool()
    async def tasks_list_tool(
        ctx: Context[ServerSession, AppContext], task_limit: int = 10
    ) -> list[Task]:
        """Get a list of tasks.
        Args:
            task_limit (int): The maximum number of tasks to return. Default is 10.
    
        Returns:
            list[Task]: A list of tasks.
        """
        database: DatabaseABC = ctx.request_context.lifespan_context.db
        tasks = database.get_tasks(limit=task_limit)
        return [Task(**task.__dict__) for task in tasks]
  • Invocation of create_tasks_tools which registers the tasks_list_tool (and other task tools) with the FastMCP server instance.
    create_tasks_tools(mcp)
  • Pydantic BaseModel schema for Task objects returned by the tasks_list_tool.
    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)
  • Enum defining TaskStatus used in the Task model schema.
    class TaskStatus(IntEnum):
        CREATED = 0
        IN_PROGRESS = 1
        COMPLETED = 2
  • Import of the create_tasks_tools function necessary for tool registration.
    from tools.tasks import create_tasks_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/chipocrudos/tasks-mcp'

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