Description of the bug
In src/formatters/SnapshotFormatter.ts, the toString() method has an inverted condition that produces a misleading hint message.
Current code (line 22-29):
if (
this.#snapshot.verbose &&
this.#snapshot.hasSelectedElement &&
!this.#snapshot.selectedElementUid
) {
chunks.push(`Note: there is a selected element in the DevTools Elements panel...`);
}
The condition checks this.#snapshot.verbose (verbose mode is already enabled), but the hint says "Get a verbose snapshot to include all elements" -- which is contradictory.
When verbose = true, the snapshot uses interestingOnly: false, meaning all elements are already included. The hint should only appear in non-verbose mode (!this.#snapshot.verbose), where interestingOnly: true may filter out the selected element.
Fix: Change this.#snapshot.verbose to !this.#snapshot.verbose on line 23.
Reproduction
- Select an element in the DevTools Elements panel that is not part of the default (non-verbose) a11y tree
- Call
take_snapshot with verbose: true
- If the selected element still cannot be resolved to a uid (e.g., due to iframe boundaries), the misleading note appears even though verbose mode is already active
Expectation
The hint "Get a verbose snapshot to include all elements" should only appear when not in verbose mode. When already in verbose mode, either no hint should be shown, or a different message should explain why the selected element is missing from the tree.
MCP configuration
No response
Chrome DevTools MCP version
latest (main branch)
Chrome version
No response
Coding agent version
No response
Model version
No response
Chat log
No response
Node version
No response
Operating system
None
Extra checklist
Description of the bug
In
src/formatters/SnapshotFormatter.ts, thetoString()method has an inverted condition that produces a misleading hint message.Current code (line 22-29):
The condition checks
this.#snapshot.verbose(verbose mode is already enabled), but the hint says "Get a verbose snapshot to include all elements" -- which is contradictory.When
verbose = true, the snapshot usesinterestingOnly: false, meaning all elements are already included. The hint should only appear in non-verbose mode (!this.#snapshot.verbose), whereinterestingOnly: truemay filter out the selected element.Fix: Change
this.#snapshot.verboseto!this.#snapshot.verboseon line 23.Reproduction
take_snapshotwithverbose: trueExpectation
The hint "Get a verbose snapshot to include all elements" should only appear when not in verbose mode. When already in verbose mode, either no hint should be shown, or a different message should explain why the selected element is missing from the tree.
MCP configuration
No response
Chrome DevTools MCP version
latest (main branch)
Chrome version
No response
Coding agent version
No response
Model version
No response
Chat log
No response
Node version
No response
Operating system
None
Extra checklist