Description of the bug
list_console_messages only returns messages logged after the most recent same-document navigation. When a page uses the History API (history.pushState / replaceState) or changes the hash to switch routes (typical single-page apps), the collected console history is silently reset even though the page never actually reloaded. This makes the tool unreliable for debugging SPA console output, and it is inconsistent with list_network_requests, which correctly keeps data across SPA route changes.
Reproduction
- Serve a page that logs to the console at load:
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>test</title></head>
<body>
<script>
console.log('BEFORE_NAV_MSG_1');
console.log('BEFORE_NAV_MSG_2');
</script>
</body>
</html>
- Start the server:
npx chrome-devtools-mcp@latest --headless
- Call
new_page with the URL above.
- Call
list_console_messages → returns BEFORE_NAV_MSG_1 and BEFORE_NAV_MSG_2.
- Call
evaluate_script to perform a same-document navigation and log again:
() => { history.pushState({}, '', '/route2'); console.log('AFTER_NAV_MSG'); return location.pathname; }
The tool response even reports Page navigated to http://localhost:8765/route2. even though the page did not reload.
- Call
list_console_messages again → only AFTER_NAV_MSG is returned; the two pre-navigation messages are gone.
Expectation
Expected behavior
A same-document navigation (no actual page reload) should not clear the console history. list_console_messages should keep returning the earlier messages, consistent with list_network_requests, which retains data across SPA route changes.
Actual behavior
The two pre-navigation messages disappear after history.pushState; only messages logged after the route change remain.
MCP configuration
No response
Chrome DevTools MCP version
1.8.0
Chrome version
152
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
list_console_messagesonly returns messages logged after the most recent same-document navigation. When a page uses the History API (history.pushState/replaceState) or changes the hash to switch routes (typical single-page apps), the collected console history is silently reset even though the page never actually reloaded. This makes the tool unreliable for debugging SPA console output, and it is inconsistent withlist_network_requests, which correctly keeps data across SPA route changes.Reproduction
npx chrome-devtools-mcp@latest --headlessnew_pagewith the URL above.list_console_messages→ returnsBEFORE_NAV_MSG_1andBEFORE_NAV_MSG_2.evaluate_scriptto perform a same-document navigation and log again:The tool response even reports
Page navigated to http://localhost:8765/route2.even though the page did not reload.list_console_messagesagain → onlyAFTER_NAV_MSGis returned; the two pre-navigation messages are gone.Expectation
Expected behavior
A same-document navigation (no actual page reload) should not clear the console history.
list_console_messagesshould keep returning the earlier messages, consistent withlist_network_requests, which retains data across SPA route changes.Actual behavior
The two pre-navigation messages disappear after
history.pushState; only messages logged after the route change remain.MCP configuration
No response
Chrome DevTools MCP version
1.8.0
Chrome version
152
Coding agent version
No response
Model version
No response
Chat log
No response
Node version
No response
Operating system
None
Extra checklist