Skip to main content
Glama

failTask

Mark a task as failed in MCPlanManager by providing a task ID and error message, with options to specify retry behavior for task management.

Instructions

将指定ID的任务标记为 'failed' (失败)。

Args: task_id (int): 需要标记为失败的任务的ID (从0开始)。 error_message (str): 描述任务失败原因的字符串。 should_retry (bool, optional): 是否应该重试该任务的标志。默认为 True。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYes
error_messageYes
should_retryNo

Implementation Reference

  • MCP tool handler for 'failTask', registered via @mcp.tool() decorator. Defines input schema via type hints and docstring, delegates to PlanManager.failTask.
    @mcp.tool()
    def failTask(task_id: int, error_message: str, should_retry: bool = True) -> ToolResponse[TaskOutput]:
        """
        将指定ID的任务标记为 'failed' (失败)。
    
        Args:
            task_id (int): 需要标记为失败的任务的ID (从0开始)。
            error_message (str): 描述任务失败原因的字符串。
            should_retry (bool, optional): 是否应该重试该任务的标志。默认为 True。
        """
        return plan_manager.failTask(task_id, error_message, should_retry)
  • Core implementation of failTask in PlanManager class. Updates task status to 'failed', sets result to error_message, clears current task ID if matching, updates timestamp, and returns success response with updated task data.
    def failTask(self, task_id: int, error_message: str, should_retry: bool = True) -> Dict:
        """标记任务失败"""
        task = self._find_task_by_id(task_id)
        if not task:
            return {"success": False, "message": f"Task {task_id} not found", "data": None}
        
        task["status"] = "failed"
        task["result"] = error_message
        
        # 如果这是当前任务,清除当前任务ID
        if self.plan_data["state"]["current_task_id"] == task_id:
            self.plan_data["state"]["current_task_id"] = None
        
        self._update_timestamp()
        
        return {
            "success": True,
            "data": task,
            "message": f"Task failed: {error_message}"
        }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool marks tasks as failed but doesn't describe what 'failed' means in the system context, whether this action is reversible, what permissions are required, or what happens to dependent tasks. For a mutation tool with zero annotation coverage, this is insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by parameter explanations. Each sentence adds value, though the formatting with 'Args:' heading could be more integrated. It's appropriately sized for a 3-parameter tool without unnecessary verbiage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 3 parameters with 0% schema coverage and no annotations or output schema, the description does well on parameters but lacks behavioral context. For a mutation tool that changes task state, the description should explain more about system behavior, consequences, and typical usage patterns to be truly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides excellent parameter semantics beyond the 0% schema coverage. It explains task_id is '从0开始' (starting from 0), error_message describes the failure reason, and should_retry is optional with default True. This fully compensates for the lack of schema descriptions and adds meaningful context about parameter usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('标记为' - mark as) and resource ('任务' - task) with the specific state 'failed'. It distinguishes from siblings like completeTask and skipTask by specifying the failure state. However, it doesn't explicitly contrast with all sibling tools like dumpPlan or visualizeDependencies, keeping it at 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like skipTask or completeTask. It mentions the tool's function but offers no context about appropriate use cases, prerequisites, or exclusions. This leaves the agent without clear decision-making criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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