Skip to content

Reduce token usage by skipping ignored accessibility nodes in snapshot output #635

@Dok11

Description

@Dok11

Is your feature request related to a problem? Please describe.

I'm using chrome-devtools-mcp with an LLM agent (via Codex CLI) and I noticed that snapshot-based tools (take_snapshot, and responses from click, etc.) generate very large textual accessibility trees.

A significant portion of the output consists of nodes with role ignored, like:

  uid=2_349 ignored
    uid=2_350 ignored
      uid=2_351 ignored
        uid=2_352 ignored
    uid=2_353 ignored
  uid=2_354 ignored
    uid=2_355 ignored
      uid=2_356 ignored
        uid=2_357 ignored
    uid=2_358 ignored
      uid=2_359 ignored
  uid=2_360 ignored
    uid=2_361 ignored
  uid=2_362 ignored
    uid=2_363 ignored
  uid=2_364 ignored
    uid=2_365 ignored

From the LLM's point of view these nodes don't carry any meaningful semantics:
they are layout-only wrappers or descendants of hidden (display: none) regions, but they still appear in the AX tree as ignored.

This makes the snapshot very verbose and dramatically increases token usage and latency when the agent consumes this text.

Describe the solution you'd like

It would be very helpful if chrome-devtools-mcp could reduce or eliminate these ignored nodes from the snapshot text that is sent to the agent.

Concretely, I would like one of the following:

  • By default, do not print nodes whose AX role is ignored and just recurse into their children instead; or
  • Add an option/argument (for example skipIgnored: true or a "compact" mode) that tells the server to drop ignored nodes from the textual snapshot.

Even a simple rule like “do not output a separate line for ignored nodes, only traverse their children” would significantly shrink the snapshot size and reduce token consumption.

In one of my snapshots there are 278 ignored nodes out of 543 total. Each line like uid=2_69 ignored is roughly ~6 tokens for the model, which means about 1,668 tokens per snapshot/click response are effectively wasted on structurally meaningless nodes.

Describe alternatives you've considered

A few things I tried or considered:

  • Hiding parts of the page with CSS (display: none) to reduce the AX tree. In practice this only helps a little: many nodes are still present as ignored, and the serializer still prints them.
  • Relying on evaluate_script with querySelector().click() instead of using click(uid) and snapshots. This works to some extent, but it bypasses the accessibility-based navigation model and requires custom JS logic per project/website.
  • Forking chrome-devtools-mcp and changing the serializer locally. This is possible, but it would be much nicer to have a built-in, configurable way to skip or collapse ignored nodes.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions