chrome-devtools-mcp icon indicating copy to clipboard operation
chrome-devtools-mcp copied to clipboard

The agent attempts to use window.location.href inside evaluate_script to scrape multiple pages in one go, which kills the execution context.

Open zyzyzyryxy opened this issue 7 months ago • 1 comments

Description of the bug

Example tool (mis)use:

// Inside evaluate_script
async () => {
  window.location.href = "https://books.toscrape.com/catalogue/..."; 
  await new Promise(r => setTimeout(r, 1000));
  return document.querySelector('td').innerText;
}

This happened without prior chrome-devtools skill activation. Observed one instance across six runs of this specific eval (nine if counting cli runs too).

After one attempt, agent correctly pivoted to using navigate_page and evaluate_script for each page separately.

Reproduction

Prompt agent to find the same information on multiple related pages (like scrapping information about multiple products from an online store).

Expectation

evaluate_script tool description should inform the agent about its limitations.

MCP configuration

any

Chrome DevTools MCP version

v0.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

zyzyzyryxy avatar Apr 17 '26 14:04 zyzyzyryxy

No longer observing such issues with newer models, stale.

zyzyzyryxy avatar Jul 01 '26 16:07 zyzyzyryxy