Playwright MCP's accessibility snapshots are optimized for LLM token consumption (~200-400 tokens per snapshot). WaveXisMCP's wavexis_a11y_snapshot already filters InlineTextBox and LineBreak nodes and uses compact refs (el-1, el-2), but it's not as aggressive as it could be.
# Full (current default)
wavexis_a11y_snapshot(session_id="abc")
-> {"snapshot": [{"ref": "el-1", "role": "webarea", "name": "Example", "level": 0, "node_id": 42, "backend_node_id": 1001, "children": [...]}]}
# Light (new)
wavexis_a11y_snapshot(session_id="abc", profile="light")
-> {"snapshot": [{"ref": "el-3", "role": "button", "name": "Login", "level": 2}, {"ref": "el-5", "role": "link", "name": "Sign up", "level": 2}]}
Add token-optimized a11y snapshot mode (like Playwright MCP)
Context
Playwright MCP's accessibility snapshots are optimized for LLM token consumption (~200-400 tokens per snapshot). WaveXisMCP's
wavexis_a11y_snapshotalready filtersInlineTextBoxandLineBreaknodes and uses compact refs (el-1,el-2), but it's not as aggressive as it could be.Adding a
compactmode would reduce token usage by 40-60%, making it cheaper to use with LLMs that charge per token.What needs to happen
In
wavexis-mcpAdd
profileparameter toA11ySnapshotInput:"full"(default) — current behavior, includes all nodes"balanced"— skip invisible elements, truncate long names, strip node_id/backend_node_id"light"— only interactive elements (buttons, links, inputs, comboboxes), strip all metadata except role + name + refAdd
max_depthparameter (default: unlimited, suggested: 10 for balanced, 5 for light)Add
truncate_names_atparameter (default: unlimited, suggested: 50 chars)Implementation in
wavexis_mcp/tools/a11y.py_format_a11y_tree()to accept profile/depth/truncate parameters"light"profile: skip nodes with roles liketext,generic,paragraph,heading(unless they have children that are interactive)"balanced"profile: skip nodes withdisplay:noneorvisibility:hidden(check vianode.get("ignored")if available from CDP)namefield totruncate_names_atchars with...suffixnode_idandbackend_node_idfrom output in balanced/light modesExpected token savings
fullbalancedlightExample
Getting started
wavexis_mcp/tools/a11y.pyto understand the current implementationwavexis_mcp/models.pyto findA11ySnapshotInput_format_a11y_tree()with the filtering logictests/unit/test_a11y.py(or equivalent)docs/tools/a11y.mdwith the new parametersReferences