The agent attempts to use MCP-specific uids (from accessibility tree snapshots) as if they were standard HTML attributes or valid element references in evaluate_script.
Description of the bug
Example of attempted tool (mis)use:
{
"name": "mcp_chrome-devtools_evaluate_script",
"args": { "function": "() => document.querySelector('[uid=\"3_125\"]').innerText" }
}
Observed once after activation of chrome-devtools skill and once without prior skill activation.
In both cases, the agent immediately realized uid is not a DOM attribute and switched to standard CSS selectors.
Reproduction
- Use
take_snapshot - Use
evaluate_script(for example to query innerText of an element)
Expectation
Agent should be informed by one of the tool descriptions or by the skill that uids are not part of the DOM and cannot be used in query selectors.
MCP configuration
any
Chrome DevTools MCP version
0.20.1
Chrome version
No response
Coding agent version
gemini-cli
Model version
gemini-2.5-flash
Chat log
No response
Node version
No response
Operating system
None
Extra checklist
- [ ] I want to provide a PR to fix this bug
hit this same pattern wiring up a macos accessibility MCP. agents see uid="3_125" in a snapshot that looks like HTML and pattern-match straight to querySelector. two things helped. one, make refs not look like attributes, we switched from uid="3_125" to ref:e5 in the serialized tree and the miscue rate dropped noticeably. two, put an explicit warning in evaluate_script's description along the lines of 'refs from take_snapshot are opaque server-side ids, not DOM attributes, use CSS/xpath/text match instead'. flash and haiku both need that spelled out or they fall back to querySelector every time, sonnet handles it without the hint.
I don't see this issue happen anymore with newer models, so I'm going to close this. If anyone feels this is still relevant, please reopen or create a new issue, mentioning a specific model / harness combination that is affected.