Skip to content

[MCP] snapshot-mode=none still serializes the ARIA snapshot #41717

Description

@dexhunter

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions