Skip to content

Add --caps tool groups: vision, pdf, storage - #2

Merged
AutomatedTester merged 1 commit into
trunkfrom
claude/project-thread-q4l6lm
Nov 18, 2026
Merged

AutomatedTester merged 1 commit into
trunkfrom
claude/project-thread-q4l6lm

Conversation

@AutomatedTester

@AutomatedTester AutomatedTester commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Requested by David · project thread

What does this PR do?

This adds the plan's opt-in tool groups to the MCP server. Names and arguments match @playwright/mcp 0.0.84. Each group is listed only when --caps names it, so the default list stays at 20 tools.

  • vision: browser_mouse_move_xy, browser_mouse_click_xy, browser_mouse_drag_xy, browser_mouse_down, browser_mouse_up and browser_mouse_wheel. Coordinates are in the top document's viewport.
  • pdf: browser_pdf_save. Without a name it writes a new file in the temp directory. A name must be inside the working directory unless --allow-unrestricted-file-access is given.
  • storage: browser_cookie_*, browser_localstorage_* and browser_sessionstorage_*, each with list, get, set, delete and clear, for the current page.

--caps network is refused with a message saying request routing comes later. An unknown group name is refused too.

Implementation notes

  • The token-budget test now covers the list without optional groups, because that is what every agent pays for.
  • WebDriver deletes cookies by name only. So a browser_cookie_delete filtered by domain or path is refused when it would also delete a same-named cookie that the filter leaves out.
  • Web Storage access is wrapped inside the page script. Pages without storage (about:blank, data:) then produce a clear error, whatever error the driver itself raises.
  • The vision fixture sets user-select: none. Otherwise a double click selects text, and a drag starting on the selection becomes a native drag that loses the mouseup.

This work was first written against SeleniumHQ/selenium before the move. It was moved over as-is after #1.

Testing

Locally: npm run test:unit (75 passing), npm run test:e2e on Chrome (51 passing), and npm run lint.

AI assistance

  • AI assisted
    • Tool(s): Claude Code
    • What was generated: the code, tests, fixture and README changes in this PR
    • I reviewed all AI output and can explain the change

Generated by Claude Code

The plan's opt-in groups, named and shaped as @playwright/mcp has
them, listed only when --caps names them so the default list stays at
20 tools:

- vision: browser_mouse_move_xy, _click_xy, _drag_xy, _down, _up and
  _wheel, by viewport coordinates of the top document.
- pdf: browser_pdf_save, to a new temp file by default; a named file
  must be inside the working directory unless
  --allow-unrestricted-file-access is given.
- storage: list, get, set, delete and clear for cookies, localStorage
  and sessionStorage of the current page. A cookie delete filtered by
  domain or path is refused when WebDriver would also delete a
  same-named cookie the filter spares.

--caps network is refused with a note that routing comes later.
@AutomatedTester AutomatedTester self-assigned this Nov 9, 2026
@AutomatedTester
AutomatedTester merged commit de8899c into trunk Nov 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant