Skip to main content
Glama
vincenthopf

Gemini Web Automation MCP

by vincenthopf

stop_web_task

Stop running web automation tasks to cancel unnecessary operations and free browser resources. Use when you need to halt long-running web activities that are no longer required.

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

Implementation Reference

  • The MCP tool handler for 'stop_web_task'. Logs the request, calls task_manager.cancel_task(task_id), and returns a success or 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 }
  • The core logic for stopping a web task. Sets the task status to 'CANCELLED', records completion time, and cleans up the associated browser agent if present.
    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

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