MCPcopy
hub / github.com/ChromeDevTools/chrome-devtools-mcp / detectOpenDevToolsWindows

Method detectOpenDevToolsWindows

src/McpContext.ts:739–764  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

737 }
738
739 async detectOpenDevToolsWindows() {
740 this.logger?.('Detecting open DevTools windows');
741 const {pages} = await this.#getAllPages();
742
743 await Promise.all(
744 pages.map(async page => {
745 const mcpPage = this.#mcpPages.get(page);
746 if (!mcpPage) {
747 return;
748 }
749
750 // Prior to Chrome 144.0.7559.59, the command fails,
751 // Some Electron apps still use older version
752 // Fall back to not exposing DevTools at all.
753 try {
754 if (await page.hasDevTools()) {
755 mcpPage.devToolsPage = await page.openDevTools();
756 } else {
757 mcpPage.devToolsPage = undefined;
758 }
759 } catch {
760 mcpPage.devToolsPage = undefined;
761 }
762 }),
763 );
764 }
765
766 getExtensionServiceWorkers(): ExtensionServiceWorker[] {
767 return this.#extensionServiceWorkers;

Callers 2

createPagesSnapshotMethod · 0.95
handleMethod · 0.80

Calls 2

#getAllPagesMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected