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
| Name | Required | Description | Default |
|---|---|---|---|
| task_limit | No |
Implementation Reference
- src/tools/tasks.py:10-23 (handler)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]
- src/config/server.py:35-35 (registration)Invocation of create_tasks_tools which registers the tasks_list_tool (and other task tools) with the FastMCP server instance.create_tasks_tools(mcp)
- src/models/tasks.py:12-18 (schema)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)
- src/models/tasks.py:6-10 (schema)Enum defining TaskStatus used in the Task model schema.class TaskStatus(IntEnum): CREATED = 0 IN_PROGRESS = 1 COMPLETED = 2
- src/config/server.py:10-10 (registration)Import of the create_tasks_tools function necessary for tool registration.from tools.tasks import create_tasks_tools