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
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a mutation ('Approve'), but doesn't specify permissions needed, side effects (e.g., if approval triggers execution), or error conditions. This leaves significant gaps for a tool that likely changes task states.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly.

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

Completeness2/5

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

Given the complexity of a mutation tool (approving plans likely changes task states) with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects like what happens post-approval, return values, or error handling, which are crucial for effective tool use.

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 description coverage is 100%, so the input schema already documents the 'taskId' parameter. The description doesn't add any meaning beyond this, such as clarifying what constitutes a valid task ID or URL format. Baseline 3 is appropriate as the schema handles the parameter documentation adequately.

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 action ('Approve') and the resource ('Jules execution plan for a task'), making the purpose understandable. However, it doesn't differentiate from siblings like 'jules_resume_task' or 'jules_get_task', which might involve similar task operations but different actions.

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. For example, it doesn't specify if this should be used after analysis or before execution, or how it differs from 'jules_resume_task' in handling task states.

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/mberjans/google-jules-mcp'

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