Skip to main content
Glama
random-robbie

MCP Web Browser Server

get_page_screenshots

Capture screenshots of web pages or specific elements using a headless browser, returning base64 encoded images for documentation or analysis.

Instructions

Capture screenshot of the current page.

Args:
    full_page: Whether to capture the entire page or just the viewport
    selector: Optional CSS selector to screenshot a specific element
    context: Optional context object for logging (ignored)

Returns:
    Base64 encoded screenshot image

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
full_pageNo
selectorNo
contextNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_page_screenshots' tool. It captures a screenshot of the current page (full page or viewport) or a specific element, encodes it as base64, and returns it. Requires a page to be loaded via 'browse_to' first.
    async def get_page_screenshots(
        full_page: bool = False, 
        selector: Optional[str] = None,
        context: Optional[Any] = None
    ) -> str:
        """
        Capture screenshot of the current page.
        
        Args:
            full_page: Whether to capture the entire page or just the viewport
            selector: Optional CSS selector to screenshot a specific element
            context: Optional context object for logging (ignored)
        
        Returns:
            Base64 encoded screenshot image
        """
        global _current_page
        
        if not _current_page:
            raise ValueError("No page is currently loaded. Use browse_to first.")
        
        try:
            if selector:
                element = await _current_page.query_selector(selector)
                if not element:
                    raise ValueError(f"No element found with selector: {selector}")
                screenshot_bytes = await element.screenshot()
            else:
                screenshot_bytes = await _current_page.screenshot(full_page=full_page)
            
            # Convert to base64 for easy transmission
            screenshot_base64 = base64.b64encode(screenshot_bytes).decode('utf-8')
            
            print(f"Screenshot captured: {'full page' if full_page else 'viewport'}", file=sys.stderr)
            
            return screenshot_base64
        
        except Exception as e:
            print(f"Error capturing screenshot: {e}", file=sys.stderr)
            raise ValueError(f"Error capturing screenshot: {e}")
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses that the tool captures screenshots and returns base64 encoded images, but doesn't mention behavioral aspects like whether it requires page load completion, handles dynamic content, has size limitations, or potential performance impacts. The 'context' parameter is noted as 'ignored', which is useful transparency.

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 efficiently structured with a clear purpose statement followed by organized Args and Returns sections. Every sentence adds value: the first states the action, and the parameter explanations are necessary for understanding usage. No wasted words.

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

Completeness4/5

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

Given the tool's moderate complexity (screenshot capture with options), no annotations, and an output schema (implied by 'Returns' statement), the description is reasonably complete. It covers purpose, parameters, and return format. However, it lacks some behavioral context like prerequisites (e.g., page must be loaded) or limitations.

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?

With 0% schema description coverage, the description compensates well by explaining all three parameters: 'full_page' (entire page vs viewport), 'selector' (CSS selector for specific element), and 'context' (ignored for logging). This adds meaningful semantics beyond the bare schema, though it doesn't provide format examples or constraints.

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 ('Capture screenshot') and resource ('of the current page'), distinguishing it from sibling tools like 'get_page_links' or 'extract_text_content' which handle different types of page content extraction.

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

Usage Guidelines3/5

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

The description implies usage through the parameter explanations (e.g., 'Whether to capture the entire page or just the viewport'), but doesn't explicitly state when to use this tool versus alternatives like 'extract_text_content' for text or 'get_page_links' for links. No explicit when-not-to-use guidance is provided.

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