Agents (Playwright MCP)
A text snapshot and an accessibility mirror that let a browser agent read and click the map.
A browser agent gets an empty region "Map" from the accessibility snapshot. Two fixes, both through Playwright MCP's
--init-script (no custom MCP server). The app needs the same one-line hook as for tests; both scripts ship in the package:
npm i -D geowrightnpx @playwright/mcp install-browser chromium # once: MCP brings its own Playwright, whose Chromium build your tests may not havenpx @playwright/mcp --config geowright-mcp.json --caps=vision --init-script node_modules/geowright/dist/inpage.js# or --init-script node_modules/geowright/dist/inpage-agent.js: + the accessibility mirror, no --caps neededgeowright-mcp.json gives headless Chromium a WebGL it can draw with (the software-WebGL flags npx geowright init writes for tests):
{ "browser": { "browserName": "chromium", "launchOptions": { "headless": true, "args": ["--disable-gpu", "--enable-unsafe-swiftshader", "--enable-features=AllowSwiftShaderFallback,AllowSoftwareGLFallbackDueToCrashes"] } }}- Text snapshot —
window.__geowright.snapshot('main')lists, per entity, its properties, a verified clickable pixel and the colour the style evaluates to for it; the agent clicks the listed pixels. It used fewer tool calls than the accessibility mirror in the recorded agent comparisons. - Accessibility mirror — features appear in the normal
browser_snapshotas buttons, and a normalbrowser_clickworks (a real click that reaches the map). Zero instructions. Also usable from tests:page.getByRole('button', { name: /Gas leak/ }).click().
The skill text for the text snapshot ships as node_modules/geowright/agent/MAP_SKILL.md (agent/MAP_SKILL.md):
give it to the agent as instructions. Results of real agent runs:
DESIGN — The agent layer.