Skip to main content
Glama
deploya-labs

browser-use MCP server

by deploya-labs

run_browser_agent

Execute browser automation tasks via natural language commands, enabling web navigation, form filling, and visual interaction with the browser-use MCP server.

Instructions

Handle run-browser-agent tool calls.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
add_infosNo
taskYes

Implementation Reference

  • The core handler function for the 'run_browser_agent' tool. It is registered via the @app.tool() decorator (line 75). Configures and initializes a CustomBrowser, CustomAgent, and executes the browser agent task based on input parameters, handling errors and cleanup.
    @app.tool()
    async def run_browser_agent(task: str, add_infos: str = "") -> str:
        """Handle run-browser-agent tool calls."""
        global _global_agent, _global_browser, _global_browser_context, _global_agent_state
    
        try:
            # Clear any previous agent stop signals
            _global_agent_state.clear_stop()
    
            # Get browser configuration
            headless = get_env_bool("BROWSER_HEADLESS", True)
            disable_security = get_env_bool("BROWSER_DISABLE_SECURITY", False)
            window_w = int(os.getenv("BROWSER_WINDOW_WIDTH", "1280"))
            window_h = int(os.getenv("BROWSER_WINDOW_HEIGHT", "720"))
    
            # Get agent configuration
            model_provider = os.getenv("MCP_MODEL_PROVIDER", "openrouter")
            model_name = os.getenv("MCP_MODEL_NAME", "openai/o3-mini-high")
            temperature = float(os.getenv("MCP_TEMPERATURE", "0.7"))
            max_steps = int(os.getenv("MCP_MAX_STEPS", "100"))
            use_vision = get_env_bool("MCP_USE_VISION", True)
            max_actions_per_step = int(os.getenv("MCP_MAX_ACTIONS_PER_STEP", "5"))
            tool_calling_method = os.getenv("MCP_TOOL_CALLING_METHOD", "auto")
    
            # Configure browser window size
            extra_chromium_args = [f"--window-size={window_w},{window_h}"]
    
            # Initialize browser if needed
            if not _global_browser:
                _global_browser = CustomBrowser(
                    config=BrowserConfig(
                        headless=headless,
                        disable_security=disable_security,
                        extra_chromium_args=extra_chromium_args,
                    )
                )
    
            # Initialize browser context if needed
            if not _global_browser_context:
                _global_browser_context = await _global_browser.new_context(
                    config=BrowserContextConfig(
                        trace_path=os.getenv("BROWSER_TRACE_PATH"),
                        save_recording_path=os.getenv("BROWSER_RECORDING_PATH"),
                        no_viewport=False,
                        browser_window_size=BrowserContextWindowSize(
                            width=window_w, height=window_h
                        ),
                    )
                )
    
            # Prepare LLM
            llm = utils.get_llm_model(
                provider=model_provider, model_name=model_name, temperature=temperature
            )
    
            # Create controller and agent
            controller = CustomController()
            _global_agent = CustomAgent(
                task=task,
                add_infos=add_infos,
                use_vision=use_vision,
                llm=llm,
                browser=_global_browser,
                browser_context=_global_browser_context,
                controller=controller,
                system_prompt_class=CustomSystemPrompt,
                agent_prompt_class=CustomAgentMessagePrompt,
                max_actions_per_step=max_actions_per_step,
                agent_state=_global_agent_state,
                tool_calling_method=tool_calling_method,
            )
    
            # Run agent with improved error handling
            try:
                history = await _global_agent.run(max_steps=max_steps)
                final_result = (
                    history.final_result()
                    or f"No final result. Possibly incomplete. {history}"
                )
                return final_result
            except asyncio.CancelledError:
                return "Task was cancelled"
            except Exception as e:
                logging.error(f"Agent run error: {str(e)}\n{traceback.format_exc()}")
                return f"Error during task execution: {str(e)}"
    
        except Exception as e:
            logging.error(f"run-browser-agent error: {str(e)}\n{traceback.format_exc()}")
            return f"Error during task execution: {str(e)}"
    
        finally:
            asyncio.create_task(_safe_cleanup())
Behavior1/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 but fails completely. It doesn't indicate whether this is a read or write operation, what side effects it might have, what permissions are required, or what the expected behavior is. The phrase 'Handle... tool calls' is too vague to convey any meaningful behavioral information.

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

Conciseness2/5

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

While the description is technically concise (only 5 words), this represents under-specification rather than effective brevity. The single sentence doesn't earn its place by providing meaningful information. A truly concise description would still convey essential purpose and usage information in minimal words, which this fails to do.

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

Completeness1/5

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

Given a tool with 2 parameters, no annotations, no output schema, and 0% schema description coverage, the description is completely inadequate. It provides no information about what the tool does, how to use it, what parameters mean, or what to expect from its operation. The description fails to compensate for any of the missing structured information.

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

Parameters1/5

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

The schema description coverage is 0%, meaning neither parameter has any description in the schema. The tool description provides no information about what the 'task' or 'add_infos' parameters mean, what format they should take, or how they affect the tool's operation. For a tool with 2 parameters and zero schema documentation, this represents a complete failure to add parameter semantics.

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

Purpose2/5

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

The description 'Handle run-browser-agent tool calls' is essentially a tautology that restates the tool name without explaining what the tool actually does. It doesn't specify what 'run-browser-agent' means, what resources it operates on, or what action it performs. While it mentions 'tool calls', this adds no meaningful information beyond the name itself.

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

Usage Guidelines1/5

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

The description provides absolutely no guidance on when to use this tool, what context it's appropriate for, or what alternatives might exist. There are no sibling tools mentioned, but even for a standalone tool, the description fails to give any indication of its intended use case or prerequisites.

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

Related 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/deploya-labs/mcp-browser-use'

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