Skip to content

fix(extensions): preserve extension metadata in structured JSON output - #3426

Closed
JIUSAN3 wants to merge 1 commit into
ChromeDevTools:mainfrom
JIUSAN3:fix/3424-extension-json
Closed

JIUSAN3 wants to merge 1 commit into
ChromeDevTools:mainfrom
JIUSAN3:fix/3424-extension-json

Conversation

@JIUSAN3

@JIUSAN3 JIUSAN3 commented Nov 7, 2026

Copy link
Copy Markdown

The list_extensions response passed Puppeteer Extension instances directly to
structuredContent. Their metadata is stored in private fields and exposed through
prototype getters, so JSON.stringify emitted one empty object per extension.
This affected both CLI JSON output and MCP structuredContent, while text output
continued to display the getter values.

Materialize the extension metadata as plain objects in the shared McpResponse
serialization path. Preserve id, name, version, enabled, and path, matching the
existing response snapshot contract. Keep the text formatter unchanged and
preserve {"extensions":[]} for an empty browser.

Add regression coverage using real CdpExtension instances with a mocked browser.
Exercise the real list_extensions tool and ToolHandler response, round-trip the
result through JSON, and pass that wire result to the CLI response formatter.
Cover enabled and disabled extensions, an empty array, and exact text output.

Validation (Windows, Node.js v24.19.0):

  • npm run format: passed.
  • npm run check-format: ESLint and Prettier passed.
  • npm run typecheck: passed; full GN/Ninja compilation succeeded.
  • npm run test:notices: bundle succeeded; notices snapshot test passed
    (1 passed, 0 failed, 0 skipped).
  • npm run test -- tests/ToolHandler.test.ts: 65 passed with the fix. Without
    the production fix, the same tests had 64 passes and 1 failure, specifically
    extension metadata serializing as [{},{}].
  • npm run test -- tests/ToolHandler.test.ts tests/McpResponse.test.ts tests/tools/extensions.test.ts tests/daemon/client.test.ts tests/index.test.ts --test-concurrency=1: 184 passed, 0 failed, 0 skipped.
  • npm run test -- --test-concurrency=1: 1798 passed, 1 failed, 5 existing
    skips (1804 tests). The only failure was the existing full-page large
    screenshot test: Chrome returned Page is too large. Confirmed the identical
    failure with the original upstream production source (28 screenshot tests
    passed, 1 failed), and with both Puppeteer's Chrome 156 and the DevTools-pinned
    Chrome 159. No assertions were removed or tests skipped for this change.
  • Live end-to-end verification against the compiled binaries and Chrome
    156.0.8078.47 passed for both the CLI daemon/JSON path and MCP stdio transport:
    fresh empty list, installation of an MV3 extension, complete serialized
    metadata, and unchanged text output. Disabled extensions are covered by the
    automated real-CdpExtension regression fixture.
  • No tool schema or description changes, no dependency changes.

The issue already has my contribution request, but it is not assigned and there
has not yet been a maintainer response. This is a Draft for maintainer feedback;
the existing Windows large-screenshot failure is documented above.

Fixes #3424

@google-cla

google-cla Bot commented Nov 7, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@JIUSAN3
JIUSAN3 force-pushed the fix/3424-extension-json branch from 1924e02 to 839f88d Compare November 7, 2026 19:57
marco-prontera pushed a commit to marco-prontera/chrome-devtools-mcp that referenced this pull request Nov 10, 2026
…hromeDevTools#3433)

Fixes ChromeDevTools#3425

list_extensions is backed by CDP Extensions.getExtensions, which only
enumerates unpacked extensions. The tool description said it lists all
installed extensions, and an empty result said "No extensions
installed.", so a profile with only Chrome Web Store extensions looked
like it had no extensions at all.

Wording only, no behavior change:

- Tool description now says it lists unpacked extensions and that Chrome
Web Store installs are not included.
- Empty-state text is now "No unpacked extensions found." and the
McpResponse test asserts the new text.
- docs/tool-reference.md and src/config/cli-options.ts regenerated with
npm run gen. tool_call_metrics.json did not change since no tool name or
args changed.
- The matching one-line comment in skills/chrome-devtools-cli/SKILL.md
updated to the same wording.

Heads up: the open PR ChromeDevTools#3426 adds a test that asserts the old "No
extensions installed." text. Whichever of the two lands second needs a
one-line update to that assertion.

Verified locally: npm run gen, npm run check-format, npm run typecheck,
and npm run test for tests/McpResponse.test.ts and
tests/tools/extensions.test.ts all pass.

Co-authored-by: Alex Rudenko <[email protected]>
@Lightning00Blade

Copy link
Copy Markdown
Collaborator

Closing as stale as the PR is marked as Draft and need rebasing. Feel free to rebase and we can re-open if it's still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(extensions): preserve list_extensions fields in JSON output

2 participants