Skip to main content
Glama
vincenthopf

Gemini Web Automation MCP

by vincenthopf

get_web_screenshots

Retrieve screenshots from web browsing sessions to review AI agent actions and page interactions during task execution.

Instructions

Retrieve screenshots captured during a web browsing session.

Each browsing session saves screenshots of the pages visited. Use this to
review what the AI agent saw and did during task execution.

Args:
    session_id: Session ID returned from browse_web or check_web_task

Returns:
    Dictionary containing:
    - ok: Boolean indicating success
    - screenshots: List of screenshot file paths
    - session_id: The session identifier
    - count: Number of screenshots found
    - error: Error message (if session not found)

Example:
    get_web_screenshots("20251017_143022_a1b2c3d4")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_web_screenshots' MCP tool. It is registered via the @mcp.tool() decorator. Lists PNG screenshots saved in the session-specific directory under SCREENSHOT_OUTPUT_DIR, returning paths relative to the parent directory.
    @mcp.tool()
    async def get_web_screenshots(session_id: str) -> dict[str, Any]:
        """
        Retrieve screenshots captured during a web browsing session.
    
        Each browsing session saves screenshots of the pages visited. Use this to
        review what the AI agent saw and did during task execution.
    
        Args:
            session_id: Session ID returned from browse_web or check_web_task
    
        Returns:
            Dictionary containing:
            - ok: Boolean indicating success
            - screenshots: List of screenshot file paths
            - session_id: The session identifier
            - count: Number of screenshots found
            - error: Error message (if session not found)
    
        Example:
            get_web_screenshots("20251017_143022_a1b2c3d4")
        """
        logger.info(f"Retrieving screenshot history for session: {session_id}")
    
        try:
            from browser_agent import SCREENSHOT_OUTPUT_DIR
    
            screenshot_dir = Path(SCREENSHOT_OUTPUT_DIR) / session_id
    
            if not screenshot_dir.exists():
                return {
                    "ok": False,
                    "error": f"No screenshots found for session {session_id}"
                }
    
            screenshots = sorted([
                str(p.relative_to(screenshot_dir.parent))
                for p in screenshot_dir.glob("*.png")
            ])
    
            return {
                "ok": True,
                "screenshots": screenshots,
                "session_id": session_id,
                "count": len(screenshots)
            }
    
        except Exception as e:
            logger.error(f"Error retrieving screenshots: {e}")
            return {
                "ok": False,
                "error": str(e)
            }
  • Constant defining the base directory for storing screenshots, used by the get_web_screenshots tool to locate session screenshots.
    SCREENSHOT_OUTPUT_DIR = os.environ.get("SCREENSHOT_OUTPUT_DIR", _default_screenshot_dir)
Behavior3/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. It discloses that the tool retrieves saved screenshots and returns a dictionary with specific fields, including error handling for 'session not found.' However, it lacks details on permissions, rate limits, or whether the operation is read-only or has side effects, which are important for a tool interacting with session data.

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

Conciseness4/5

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

The description is well-structured with a clear purpose statement, usage context, parameter details, return values, and an example. It is appropriately sized, but the example could be integrated more seamlessly, and some sentences like 'Each browsing session saves screenshots...' slightly extend beyond strict necessity.

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, no annotations, and an output schema (implied by the Returns section), the description is mostly complete. It covers purpose, usage, parameters, and return values. However, it lacks details on behavioral aspects like error conditions beyond 'session not found' or performance considerations, leaving minor gaps.

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

Parameters5/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 explicitly documents the single parameter: 'session_id: Session ID returned from browse_web or check_web_task,' adding crucial meaning by specifying the source of the session_id and its purpose, which the schema alone does not provide.

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 tool's purpose: 'Retrieve screenshots captured during a web browsing session.' It specifies the verb ('retrieve'), resource ('screenshots'), and context ('web browsing session'), distinguishing it from siblings like browse_web or check_web_task by focusing on post-session retrieval rather than active browsing or task management.

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 provides clear context for when to use this tool: 'Each browsing session saves screenshots... Use this to review what the AI agent saw and did during task execution.' It implies usage after a session has ended, but does not explicitly state when not to use it or name alternatives, such as checking if a session exists first.

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