Skip to main content
Glama
vincenthopf

Gemini Web Automation MCP

by vincenthopf

stop_web_task

Stop a running web automation task to cancel unnecessary operations and free browser resources. Use this tool to halt long-running tasks immediately.

Instructions

Stop a running web browsing task.

Immediately halts task execution and cleans up browser resources. Use this
when you need to cancel a long-running task that's no longer needed.

Args:
    task_id: Task ID from start_web_task()

Returns:
    Dictionary containing:
    - ok: Boolean indicating success
    - message: Confirmation message
    - task_id: The stopped task ID
    - error: Error message (if task not found or already completed)

Examples:
    - stop_web_task("abc-123-def")

Note: Cannot stop tasks that are already completed or failed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler for the 'stop_web_task' tool. Decorated with @mcp.tool() for automatic registration in the MCP server. Handles input validation via type hints, logs the action, calls the task_manager helper, and returns a standardized success/error response dictionary.
    async def stop_web_task(task_id: str) -> dict[str, Any]:
        """
        Stop a running web browsing task.
    
        Immediately halts task execution and cleans up browser resources. Use this
        when you need to cancel a long-running task that's no longer needed.
    
        Args:
            task_id: Task ID from start_web_task()
    
        Returns:
            Dictionary containing:
            - ok: Boolean indicating success
            - message: Confirmation message
            - task_id: The stopped task ID
            - error: Error message (if task not found or already completed)
    
        Examples:
            - stop_web_task("abc-123-def")
    
        Note: Cannot stop tasks that are already completed or failed.
        """
        logger.info(f"Stopping web task: {task_id}")
    
        success = task_manager.cancel_task(task_id)
    
        if success:
            return {
                "ok": True,
                "message": f"Task {task_id} cancelled successfully",
                "task_id": task_id
            }
        else:
            return {
                "ok": False,
                "error": f"Could not cancel task {task_id} (not found or already completed)",
                "task_id": task_id
            }
  • Core helper method in BrowserTaskManager that implements task cancellation logic: checks if cancellable, updates status to CANCELLED, sets completion time, and cleans up associated browser agent.
    def cancel_task(self, task_id: str) -> bool:
        """Cancel a running task.
    
        Args:
            task_id: Task identifier
    
        Returns:
            True if task was cancelled, False otherwise
        """
        with self._lock:
            task = self.tasks.get(task_id)
            if not task or task.status not in [TaskStatus.PENDING, TaskStatus.RUNNING]:
                return False
    
            task.status = TaskStatus.CANCELLED
            task.completed_at = datetime.now(timezone.utc).isoformat()
    
            # Clean up browser if running
            if task.agent:
                task.agent.cleanup_browser()
    
            return True
Behavior4/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 effectively describes key behaviors: immediate halting of execution, cleanup of browser resources, and constraints on stopping completed/failed tasks. However, it doesn't mention potential side effects like data loss or error handling details beyond the return structure.

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 well-structured and front-loaded with the core purpose, followed by usage guidelines, parameter details, return values, examples, and constraints. Every sentence adds value without redundancy, making it efficient and easy to parse.

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

Completeness5/5

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

Given the tool's complexity (a destructive operation with one parameter), no annotations, and the presence of an output schema (which covers return values), the description is complete. It explains purpose, usage, parameters, returns, examples, and constraints, leaving no significant gaps for an agent to understand and invoke the tool correctly.

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

Parameters4/5

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

The schema description coverage is 0%, so the description must compensate. It provides clear semantics for the single parameter (task_id from start_web_task()) and includes an example. While it doesn't detail format constraints beyond the example, it adds meaningful context beyond the bare schema.

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

Purpose5/5

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

The description clearly states the specific action ('stop', 'halts', 'cancels') and resource ('web browsing task'), distinguishing it from siblings like check_web_task, list_web_tasks, or wait. It explicitly mentions the tool stops a 'running' task, which differentiates it from tools that might handle completed or failed tasks.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('when you need to cancel a long-running task that's no longer needed') and when not to use it ('Cannot stop tasks that are already completed or failed'). It also implies alternatives by referencing start_web_task and other siblings for different operations.

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/vincenthopf/computer-use-mcp'

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