Description
When MCP is configured with snapshot-mode=none, response construction still calls Tab.captureSnapshot(), which always runs page.ariaSnapshot(). The serialized snapshot is then discarded because the response does not include a Snapshot section.
On a large deterministic page, the current snapshotless response path measured about 166 ms. A narrow prototype that skips only the unused ARIA serialization measured about 4.6 ms, while preserving page headers, modal state, console links, download events, and output-budget cleanup.
The relevant path is:
packages/playwright-core/src/tools/backend/response.ts
packages/playwright-core/src/tools/backend/tab.ts
Expected behavior
With snapshot-mode=none, MCP should avoid generating an ARIA snapshot that will not be returned. It should continue to collect and emit all non-snapshot response state, including:
- changed tab/page headers
- modal state
- console links
- download events
- output-budget housekeeping
Proposed change
Pass whether an ARIA snapshot is needed into Tab.captureSnapshot() and conditionally skip only the ariaSnapshot() call inside the existing modal-state race. Keep the rest of the response-building path unchanged.
I would like to work on this and can add focused coverage to the existing MCP snapshot-mode, console, dialogs, files, tabs, and output-size tests.
Description
When MCP is configured with
snapshot-mode=none, response construction still callsTab.captureSnapshot(), which always runspage.ariaSnapshot(). The serialized snapshot is then discarded because the response does not include a Snapshot section.On a large deterministic page, the current snapshotless response path measured about 166 ms. A narrow prototype that skips only the unused ARIA serialization measured about 4.6 ms, while preserving page headers, modal state, console links, download events, and output-budget cleanup.
The relevant path is:
packages/playwright-core/src/tools/backend/response.tspackages/playwright-core/src/tools/backend/tab.tsExpected behavior
With
snapshot-mode=none, MCP should avoid generating an ARIA snapshot that will not be returned. It should continue to collect and emit all non-snapshot response state, including:Proposed change
Pass whether an ARIA snapshot is needed into
Tab.captureSnapshot()and conditionally skip only theariaSnapshot()call inside the existing modal-state race. Keep the rest of the response-building path unchanged.I would like to work on this and can add focused coverage to the existing MCP snapshot-mode, console, dialogs, files, tabs, and output-size tests.