skipTask
Mark specific tasks as 'skipped' in MCPlanManager to resolve dependencies and enable subsequent tasks to proceed, with an optional reason for skipping.
Instructions
将指定ID的任务标记为 'skipped' (已跳过)。 被跳过的任务在依赖解析中被视为“已完成”,允许后续任务继续。
Args: task_id (int): 需要跳过的任务的ID (从0开始)。 reason (str): 解释为何跳过此任务的字符串。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| reason | Yes | ||
| task_id | Yes |
Implementation Reference
- src/mcplanmanager/app.py:135-145 (handler)The MCP tool handler and registration for 'skipTask'. Decorated with @mcp.tool() which registers it, defines input schema via type hints and docstring, and executes by calling PlanManager.skipTask.@mcp.tool() def skipTask(task_id: int, reason: str) -> ToolResponse[TaskOutput]: """ 将指定ID的任务标记为 'skipped' (已跳过)。 被跳过的任务在依赖解析中被视为“已完成”,允许后续任务继续。 Args: task_id (int): 需要跳过的任务的ID (从0开始)。 reason (str): 解释为何跳过此任务的字符串。 """ return plan_manager.skipTask(task_id, reason)
- The core logic implementation of skipTask in the PlanManager class. Finds the task, validates status (pending or failed), sets status to 'skipped', updates result with reason, and returns response.def skipTask(self, task_id: int, reason: str) -> Dict: """跳过任务""" task = self._find_task_by_id(task_id) if not task: return {"success": False, "message": f"Task {task_id} not found"} if task["status"] not in ["pending", "failed"]: return {"success": False, "message": f"Only pending or failed tasks can be skipped. Task {task_id} has status '{task['status']}'"} task["status"] = "skipped" task["result"] = f"Skipped: {reason}" self._update_timestamp() return { "success": True, "data": task, "message": f"Task {task_id} skipped. Reason: {reason}" }