Skip to main content
Glama

getCurrentTask

Retrieve details of the currently active task marked as 'in_progress' from the MCPlanManager task management system.

Instructions

获取当前标记为 'in_progress' (正在进行中) 的任务详情。

Returns: ToolResponse[TaskOutput]: 包含当前任务详情的响应对象。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'getCurrentTask'. Decorated with @mcp.tool() which registers it, and delegates to PlanManager instance.
    @mcp.tool()
    def getCurrentTask() -> ToolResponse[TaskOutput]:
        """
        获取当前标记为 'in_progress' (正在进行中) 的任务详情。
        
        Returns:
            ToolResponse[TaskOutput]: 包含当前任务详情的响应对象。
        """
        return plan_manager.getCurrentTask()
  • Core logic of getCurrentTask in PlanManager class: retrieves the task with ID from state.current_task_id if exists.
    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}
  • Pydantic model TaskOutput defining the structure of a task returned by the tool.
    class TaskOutput(BaseModel):
        """
        用于工具函数返回任务信息时,定义单个任务输出的Pydantic模型。
        """
        id: int
        name: str
        status: str
        dependencies: List[int]
        reasoning: str
        result: Optional[str] = None
  • Pydantic model ToolResponse[TaskOutput] defining the return type of the tool.
    class ToolResponse(BaseModel, Generic[T]):
        """
        一个通用的工具响应模型,用于标准化所有工具的返回结构。
        """
        success: bool = Field(True, description="操作是否成功。")
        message: Optional[str] = Field(None, description="关于操作结果的可读消息。")
        data: Optional[T] = Field(None, description="操作返回的主要数据负载。")

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/donway19/MCPlanManager'

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