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

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)

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