getTaskList
Retrieve and filter task lists by status (pending, in_progress, completed, failed, skipped) from the MCPlanManager MCP server for efficient task management.
Instructions
获取计划中所有任务的列表,可按状态进行过滤。
Args: status_filter (str, optional): 用于过滤任务的状态字符串。 可接受的值: 'pending', 'in_progress', 'completed', 'failed', 'skipped'。
Returns: ToolResponse[List[TaskOutput]]: 包含任务列表的响应对象。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status_filter | No |
Implementation Reference
- src/mcplanmanager/app.py:171-183 (handler)The decorated MCP tool handler for 'getTaskList'. It receives the status_filter parameter and delegates execution to the PlanManager instance's getTaskList method, returning a ToolResponse.@mcp.tool() def getTaskList(status_filter: Optional[str] = None) -> ToolResponse[List[TaskOutput]]: """ 获取计划中所有任务的列表,可按状态进行过滤。 Args: status_filter (str, optional): 用于过滤任务的状态字符串。 可接受的值: 'pending', 'in_progress', 'completed', 'failed', 'skipped'。 Returns: ToolResponse[List[TaskOutput]]: 包含任务列表的响应对象。 """ return plan_manager.getTaskList(status_filter)
- Core implementation in PlanManager class that filters the tasks list by optional status_filter and returns it wrapped in a success dict.def getTaskList(self, status_filter: Optional[str] = None) -> Dict: """获取任务列表,可按状态过滤""" if status_filter: tasks_to_return = [ task for task in self.plan_data["tasks"] if task["status"] == status_filter ] else: tasks_to_return = self.plan_data["tasks"] return {"success": True, "data": tasks_to_return}
- src/mcplanmanager/models.py:33-43 (schema)Pydantic model defining the structure of each TaskOutput in the tool's response list.class TaskOutput(BaseModel): """ 用于工具函数返回任务信息时,定义单个任务输出的Pydantic模型。 """ id: int name: str status: str dependencies: List[int] reasoning: str result: Optional[str] = None
- src/mcplanmanager/models.py:6-12 (schema)Generic Pydantic model for ToolResponse[T], used as return type ToolResponse[List[TaskOutput]].class ToolResponse(BaseModel, Generic[T]): """ 一个通用的工具响应模型,用于标准化所有工具的返回结构。 """ success: bool = Field(True, description="操作是否成功。") message: Optional[str] = Field(None, description="关于操作结果的可读消息。") data: Optional[T] = Field(None, description="操作返回的主要数据负载。")