From 079c189e0ae9664c36d8d47d301519ca5ef8689b Mon Sep 17 00:00:00 2001 From: Deeman Date: Sat, 21 Feb 2026 17:34:08 +0100 Subject: [PATCH] scout: add scout_click_coords tool, document Sourcepoint limitation - Add scout_click_coords for manual coordinate-based clicks (useful when CSS selectors can't reach cross-origin iframes) - Document in _dismiss_cookie_banner why Sourcepoint is not auto-dismissed: HAR captures traffic regardless of banner visibility; coordinate clicks are too brittle across screen sizes - Add missing asyncio import to server.py Co-Authored-By: Claude Sonnet 4.6 --- tools/scout/src/scout/browser.py | 5 +++++ tools/scout/src/scout/server.py | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tools/scout/src/scout/browser.py b/tools/scout/src/scout/browser.py index 4df75f7..f58d323 100644 --- a/tools/scout/src/scout/browser.py +++ b/tools/scout/src/scout/browser.py @@ -214,6 +214,11 @@ async def _dismiss_cookie_banner(tab) -> bool: except Exception: continue + # Note: cross-origin full-page iframe banners (Sourcepoint on German publishers) + # are not dismissed here — coordinate clicks are too brittle across screen sizes. + # HAR recording captures network traffic regardless of banner visibility, + # so dismissal is only needed when we must click navigation elements. + # For those cases, use scout_click_coords manually. return False diff --git a/tools/scout/src/scout/server.py b/tools/scout/src/scout/server.py index f662dd8..d65bfaa 100644 --- a/tools/scout/src/scout/server.py +++ b/tools/scout/src/scout/server.py @@ -14,6 +14,7 @@ Usage (via .mcp.json): uv run --package scout scout-server """ +import asyncio import logging import sys @@ -160,6 +161,22 @@ async def scout_analyze(har_path: str) -> str: return analyze.format_summary(summary) +@mcp.tool() +async def scout_click_coords(x: int, y: int) -> str: + """Click at specific viewport coordinates. Useful for cross-origin iframes + where CSS selectors can't reach (e.g. Sourcepoint cookie banners on German sites). + + Args: + x: Horizontal pixel position from left edge. + y: Vertical pixel position from top edge. + """ + assert browser._state["tab"] is not None, "No browser open — call scout_visit first" + await browser._state["tab"].mouse.click(x, y) + await asyncio.sleep(1.0) + title = await browser._state["tab"].title + return f"Clicked at ({x}, {y})\nCurrent title: {title}" + + @mcp.tool() async def scout_js(script: str) -> str: """Execute JavaScript on the current page and return the result.