getPlanStatus
Retrieve a comprehensive overview of a plan, including metadata, progress, and task status statistics, for effective task management within the MCPlanManager system.
Instructions
获取整个计划的全面概览,包括元数据、进度、任务状态统计等。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcplanmanager/app.py:166-170 (handler)The MCP tool handler function for getPlanStatus, decorated with @mcp.tool() to register and execute the tool by delegating to PlanManager.getPlanStatus()@mcp.tool() def getPlanStatus() -> ToolResponse[PlanStatusData]: """获取整个计划的全面概览,包括元数据、进度、任务状态统计等。""" return plan_manager.getPlanStatus()
- Core PlanManager method implementing the logic to compute and return detailed plan status, including metadata, progress percentages, and task status counts.def getPlanStatus(self) -> Dict: """获取计划状态""" total_tasks = len(self.plan_data["tasks"]) if total_tasks == 0: return { "success": True, "data": { "meta": self.plan_data["meta"], "state": self.plan_data["state"], "progress": {"completed_tasks": 0, "total_tasks": 0, "progress_percentage": 0.0}, "task_counts": {"pending": 0, "in_progress": 0, "completed": 0, "failed": 0, "skipped": 0, "total": 0} } } completed_count = sum(1 for task in self.plan_data["tasks"] if task["status"] in ["completed", "skipped"]) progress_percentage = (completed_count / total_tasks) * 100 if total_tasks > 0 else 0 task_counts = {} for task in self.plan_data["tasks"]: status = task["status"] task_counts[status] = task_counts.get(status, 0) + 1 status_data = { "meta": self.plan_data["meta"], "state": self.plan_data["state"], "progress": { "completed_tasks": completed_count, "total_tasks": total_tasks, "progress_percentage": round(progress_percentage, 2) }, "task_counts": { "pending": task_counts.get("pending", 0), "in_progress": task_counts.get("in_progress", 0), "completed": task_counts.get("completed", 0), "failed": task_counts.get("failed", 0), "skipped": task_counts.get("skipped", 0), "total": total_tasks } } return {"success": True, "data": status_data}
- src/mcplanmanager/models.py:66-74 (schema)Pydantic model defining the structured output data for the getPlanStatus tool response, including submodels for meta, state, progress, and task counts.class PlanStatusData(BaseModel): """ 用于getPlanStatus工具,定义其返回数据的详细模型。 """ meta: PlanStatusMeta state: PlanStatusState progress: PlanProgress task_counts: PlanTaskCounts
- src/mcplanmanager/app.py:166-170 (registration)The @mcp.tool() decorator registers the getPlanStatus function as an MCP tool.@mcp.tool() def getPlanStatus() -> ToolResponse[PlanStatusData]: """获取整个计划的全面概览,包括元数据、进度、任务状态统计等。""" return plan_manager.getPlanStatus()