Skip to main content
Glama
random-robbie

MCP Web Browser Server

browse_to

Navigate to any URL and retrieve the full HTML content for web scraping, data extraction, or automated browsing tasks.

Instructions

Navigate to a specific URL and return the page's HTML content.

Args:
    url: The full URL to navigate to
    context: Optional context object for logging (ignored)

Returns:
    The full HTML content of the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
contextNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'browse_to' tool. Uses Playwright to launch a browser (if needed), create a new page, navigate to the given URL with networkidle wait and 30s timeout, ignoring HTTPS errors, and returns the full HTML content of the page.
    @mcp.tool()
    async def browse_to(url: str, context: Optional[Any] = None) -> str:
        """
        Navigate to a specific URL and return the page's HTML content.
        
        Args:
            url: The full URL to navigate to
            context: Optional context object for logging (ignored)
        
        Returns:
            The full HTML content of the page
        """
        global _current_page, _browser, _browser_context
        
        # Ensure browser is launched with SSL validation disabled
        _, browser_context = await _ensure_browser()
        
        # Close any existing page
        await _close_current_page()
        
        # Optional logging, but do nothing with context
        print(f"Navigating to {url}", file=sys.stderr)
        
        try:
            # Create a new page and navigate
            _current_page = await browser_context.new_page()
            
            # Additional options to handle various SSL/security issues
            await _current_page.goto(url, 
                wait_until='networkidle',
                timeout=30000,  # 30 seconds timeout
            )
            
            # Get full page content including dynamically loaded JavaScript
            page_content = await _current_page.content()
            
            # Optional: extract additional metadata
            try:
                title = await _current_page.title()
                print(f"Page title: {title}", file=sys.stderr)
            except Exception:
                pass
            
            return page_content
        
        except Exception as e:
            print(f"Error navigating to {url}: {e}", file=sys.stderr)
            raise
  • The @mcp.tool() decorator registers the browse_to function as an MCP tool.
    @mcp.tool()
  • Helper function to ensure the Playwright Chromium browser and context are initialized, with HTTPS errors ignored.
    async def _ensure_browser():
        """Ensure a browser instance is available with SSL validation disabled"""
        global _browser, _browser_context, _playwright_instance
        
        if _browser is None:
            playwright_module = _import_playwright()
            _playwright_instance = await playwright_module().start()
            _browser = await _playwright_instance.chromium.launch()
            
            # Create a browser context that ignores HTTPS errors
            _browser_context = await _browser.new_context(
                ignore_https_errors=True,  # Ignore SSL certificate errors
            )
        return _browser, _browser_context
  • Helper to close the current browser page before navigating to a new URL.
    async def _close_current_page():
        """Close the current page if it exists"""
        global _current_page
        if _current_page:
            try:
                await _current_page.close()
            except Exception:
                pass
            _current_page = None
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions navigation and returning HTML content, but fails to describe critical behaviors such as timeouts, error handling, JavaScript execution, or network conditions. This leaves significant gaps for a tool that interacts with external resources.

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 front-loaded with the core purpose, followed by structured sections for arguments and returns. Every sentence adds value without redundancy, making it efficient and easy to parse. The formatting enhances readability without unnecessary verbosity.

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?

Given the tool's complexity (external navigation) and lack of annotations, the description is moderately complete but has gaps. It explains the return value, and an output schema exists, so return details aren't needed. However, it omits behavioral aspects like performance or security considerations, which are important for such a tool.

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?

Schema description coverage is 0%, so the description must compensate. It explains the 'url' parameter's purpose ('full URL to navigate to') and notes that 'context' is optional and ignored for logging, adding meaningful semantics beyond the bare schema. However, it doesn't detail URL format requirements or context structure.

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 ('Navigate to a specific URL') and resource ('page's HTML content'), distinguishing it from siblings like click_element or input_text that perform different browser interactions. It precisely defines the tool's function without being vague or tautological.

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

Usage Guidelines4/5

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

The description implies usage for retrieving HTML content from URLs, which provides clear context, but it doesn't explicitly state when to use this tool versus alternatives like get_page_links or extract_text_content. No misleading guidance is present, but it lacks explicit exclusions or named alternatives.

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/random-robbie/mcp-web-browser'

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