Skip to main content
Glama

jules_approve_plan

Approve execution plans for Google Jules AI coding tasks to proceed with automated development workflows and code generation.

Instructions

Approve Jules execution plan for a task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesTask ID or URL

Implementation Reference

  • Executes the jules_approve_plan tool by navigating to the Jules task page with Playwright, locating the approval button via CSS selector, clicking it if present, and returning appropriate success or status messages.
    private async approvePlan(args: any) {
      const { taskId } = args;
      const actualTaskId = this.extractTaskId(taskId);
      const page = await this.getPage();
    
      try {
        const url = taskId.includes('jules.google.com') ? taskId : `${this.config.baseUrl}/task/${actualTaskId}`;
        await page.goto(url);
        await page.waitForLoadState('networkidle');
    
        // Look for approval button
        const approveButton = page.locator("div.approve-plan-container > button");
        if (await approveButton.isVisible()) {
          await approveButton.click();
          
          return {
            content: [
              {
                type: 'text',
                text: `Plan approved for task ${actualTaskId}. Jules will now execute the planned changes.`
              }
            ]
          };
        } else {
          return {
            content: [
              {
                type: 'text',
                text: `No plan approval needed for task ${actualTaskId}. The task may already be approved or not ready for approval yet.`
              }
            ]
          };
        }
      } catch (error) {
        throw new Error(`Failed to approve plan: ${error}`);
      }
    }
  • Input schema for the jules_approve_plan tool, requiring a 'taskId' parameter as a string (can be task ID or full URL).
      name: 'jules_approve_plan',
      description: 'Approve Jules execution plan for a task',
      inputSchema: {
        type: 'object',
        properties: {
          taskId: {
            type: 'string',
            description: 'Task ID or URL',
          },
        },
        required: ['taskId'],
      },
    },
  • src/index.ts:372-373 (registration)
    Tool registration/dispatch in the MCP CallToolRequestSchema handler switch statement, mapping 'jules_approve_plan' calls to the approvePlan method.
      return await this.approvePlan(args);
    case 'jules_resume_task':
  • Helper function used by approvePlan (and other tools) to normalize taskId input, extracting ID from full Jules URLs if provided.
    private extractTaskId(taskIdOrUrl: string): string {
      if (taskIdOrUrl.includes('jules.google.com/task/')) {
        const match = taskIdOrUrl.match(/\/task\/([^/]+)/);
        return match ? match[1] : taskIdOrUrl;
      }
      return taskIdOrUrl;
    }
  • Python client-side wrapper function that invokes the MCP 'jules_approve_plan' tool, validates task status, updates local storage, and handles responses.
    def approve_plan(manager: Dict[str, Any], task_id: str) -> bool:
        """Approve a plan via MCP and update task status.
    
        Args:
            manager: Job manager dictionary produced by ``create_job_manager``.
            task_id: Identifier for the task awaiting approval.
    
        Returns:
            Boolean representing whether approval succeeded.
    
        Raises:
            ValueError: When dependencies are missing or task is not in approval state.
            KeyError: If the task does not exist in storage.
            RuntimeError: When MCP invocation fails or returns an error payload.
        """
    
        validated_id = _validate_task_identifier(task_id)
        mcp_client = manager.get("mcp_client")
        if mcp_client is None:
            raise ValueError("MCP client is missing")
        storage_manager = manager.get("storage")
        if storage_manager is None:
            raise ValueError("Storage manager is missing")
        existing_task = storage.get_task(storage_manager, validated_id)
        normalized_task = models.jules_task_from_dict(existing_task)
        current_status = normalized_task.get("status")
        if current_status != "waiting_approval":
            raise ValueError("Task must be waiting for approval")
        payload = {"taskId": validated_id}
        LOGGER.info("Approving plan via MCP", extra=payload)
        try:
            response = _invoke_mcp_tool(mcp_client, "jules_approve_plan", payload)
        except Exception as error:  # noqa: BLE001
            LOGGER.error("MCP invocation failed", extra={"task_id": validated_id})
            raise RuntimeError("Failed to approve plan via MCP") from error
        text_payload = _extract_response_text(response)
        try:
            raw_data = json.loads(text_payload)
        except json.JSONDecodeError as error:
            raise ValueError("Unable to parse approval payload") from error
        if not isinstance(raw_data, dict):
            raise ValueError("Approval payload must be a dictionary")
        success_value = raw_data.get("success")
        if success_value is False:
            return False
        if raw_data.get("error"):
            message_text = str(raw_data.get("error"))
            raise RuntimeError(f"MCP plan approval failed: {message_text}")
        if success_value is None:
            raise ValueError("Approval payload missing success indicator")
        if success_value is not True:
            raise ValueError("Unexpected success value in approval payload")
        normalized_task["status"] = "in_progress"
        normalized_task["updated_at"] = datetime.now().astimezone()
        serialized_task = models.jules_task_to_dict(normalized_task)
        storage.save_task(storage_manager, serialized_task)
        return True

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It only says 'Approve', implying a write operation but omits details like irreversibility, side effects (e.g., triggering execution), or required permissions.

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 a single, clear sentence with no wasted words. However, it lacks structure like separate sections for purpose, usage, and behavior.

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?

For a simple one-parameter tool with no output schema or annotations, the description is minimally adequate but not informative beyond the bare action. It does not help an agent decide when to invoke this tool over siblings.

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

Parameters3/5

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

Schema coverage is 100% (only taskId), and the description adds no extra meaning beyond the schema's 'Task ID or URL'. Baseline 3 with no additional parameter context.

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 'Approve' and the resource 'Jules execution plan for a task', making the tool's purpose immediately understandable. However, it does not differentiate from siblings like jules_resume_task, which could be seen as a related action.

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?

No guidance is provided on when to use this tool versus alternatives (e.g., jules_resume_task, jules_send_message). The description lacks any contextual signals about prerequisites or exclusions.

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