list_console_messages `serviceWorkerId` expects an extension ID, not the `sw-N` id shown by `list_pages`
Description of the bug
With --categoryExtensions, list_pages lists extension service workers with ids like sw-1, and evaluate_script accepts that same id via its serviceWorkerId param. But list_console_messages also has a param named serviceWorkerId ("Filter messages to only return messages of the specified service worker"), and passing sw-1 there always returns <no console messages found>, even when the worker has logged plenty.
It turns out the value is used as an extension ID: McpResponse passes it to context.getServiceWorkerConsoleData(), which looks up ServiceWorkerConsoleCollector storage keyed by extension ID. The console test does the same (params: {serviceWorkerId: extensionId} in tests/tools/console.test.ts). Passing the extension ID works and returns all the logs.
So capture works fine. The problem is that two params with the same name take different kinds of ID, the description doesn't mention extension IDs, and an unknown ID fails silently with an empty result instead of an error. I (and the agent I was using) lost a fair bit of time assuming service worker logs weren't being captured at all.
Reproduction
- Start with
--categoryExtensionsandinstall_extensionan unpacked MV3 extension. list_pages, which showssw-1: chrome-extension://<ext-id>/background.jsevaluate_scriptwithserviceWorkerId: "sw-1"and() => console.log('hello'), which succeeds.list_console_messageswithserviceWorkerId: "sw-1"returns<no console messages found>.list_console_messageswithserviceWorkerId: "<ext-id>"returnshelloplus all earlier worker logs.
Expectation
list_console_messages should accept the sw-N id from list_pages, consistent with evaluate_script. Failing that, the param should be documented and named as an extension ID. Either way, an unrecognized ID should return an error rather than an empty list.
Possible fix: resolve sw-N to its extension ID (the ExtensionServiceWorker snapshot already has both). Keep accepting a raw extension ID for backward compatibility, update the param description and docs/tool-reference.md, and throw on unknown IDs. I'm happy to send a PR for whichever direction you prefer. I'm also aware that #2800 is reworking worker ids, so I'm glad to wait for it or rebase on top of it.
MCP configuration
{ "command": "cmd", "args": ["/c", "npx", "-y", "chrome-devtools-mcp@latest", "--categoryExtensions"] }- Chrome DevTools MCP version: 1.10.1
- Chrome version: 153.0.8010.53
- Coding agent version: Claude Code 2.1.281
- Model version: claude-opus-5-5
- Node version: v22.16.0
- Operating system: Windows
- I want to provide a PR to fix this bug
Source: ChromeDevTools/chrome-devtools-mcp