getCurrentTask
Retrieve details of the task currently marked as 'in_progress' in the MCPlanManager system. Provides task information for effective AI agent task management and planning.
Instructions
获取当前标记为 'in_progress' (正在进行中) 的任务详情。
Returns: ToolResponse[TaskOutput]: 包含当前任务详情的响应对象。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcplanmanager/app.py:74-82 (handler)MCP tool handler function for 'getCurrentTask'. The @mcp.tool() decorator registers the tool with FastMCP. It retrieves the current in-progress task by delegating to PlanManager.getCurrentTask().@mcp.tool() def getCurrentTask() -> ToolResponse[TaskOutput]: """ 获取当前标记为 'in_progress' (正在进行中) 的任务详情。 Returns: ToolResponse[TaskOutput]: 包含当前任务详情的响应对象。 """ return plan_manager.getCurrentTask()
- Core implementation logic in PlanManager that fetches the current task (in_progress) from the plan data structure, handling cases where no task or task not found.def getCurrentTask(self) -> Dict: """获取当前正在执行的任务""" current_id = self.plan_data["state"]["current_task_id"] if current_id is None: return {"success": False, "message": "No task is currently active"} task = self._find_task_by_id(current_id) if not task: return {"success": False, "message": f"Current task {current_id} not found"} return {"success": True, "data": task}
- src/mcplanmanager/models.py:33-43 (schema)Pydantic model defining the structure of a TaskOutput, used in the return type ToolResponse[TaskOutput] of the handler.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], wrapping the success, message, and data fields for all tool responses.class ToolResponse(BaseModel, Generic[T]): """ 一个通用的工具响应模型,用于标准化所有工具的返回结构。 """ success: bool = Field(True, description="操作是否成功。") message: Optional[str] = Field(None, description="关于操作结果的可读消息。") data: Optional[T] = Field(None, description="操作返回的主要数据负载。")