chrome-devtools-mcp 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/src/McpContext.js
CHANGED
|
@@ -80,6 +80,14 @@ export class McpContext {
|
|
|
80
80
|
this.#consoleCollector.addPage(page);
|
|
81
81
|
return page;
|
|
82
82
|
}
|
|
83
|
+
async closePage(pageIdx) {
|
|
84
|
+
if (this.#pages.length === 1) {
|
|
85
|
+
throw new Error('Unable to close the last page in the browser. It is fine to keep the last page open.');
|
|
86
|
+
}
|
|
87
|
+
const page = this.getPageByIdx(pageIdx);
|
|
88
|
+
this.setSelectedPageIdx(0);
|
|
89
|
+
await page.close({ runBeforeUnload: false });
|
|
90
|
+
}
|
|
83
91
|
getNetworkRequestByUrl(url) {
|
|
84
92
|
const requests = this.getNetworkRequests();
|
|
85
93
|
if (!requests.length) {
|
package/build/src/tools/pages.js
CHANGED
|
@@ -39,7 +39,7 @@ export const selectPage = defineTool({
|
|
|
39
39
|
});
|
|
40
40
|
export const closePage = defineTool({
|
|
41
41
|
name: 'close_page',
|
|
42
|
-
description: `Closes the page by its index.`,
|
|
42
|
+
description: `Closes the page by its index. The last open page cannot be closed.`,
|
|
43
43
|
annotations: {
|
|
44
44
|
category: ToolCategories.NAVIGATION_AUTOMATION,
|
|
45
45
|
readOnlyHint: false,
|
|
@@ -50,9 +50,7 @@ export const closePage = defineTool({
|
|
|
50
50
|
.describe('The index of the page to close. Call list_pages to list pages.'),
|
|
51
51
|
},
|
|
52
52
|
handler: async (request, response, context) => {
|
|
53
|
-
|
|
54
|
-
context.setSelectedPageIdx(0);
|
|
55
|
-
await page.close({ runBeforeUnload: false });
|
|
53
|
+
await context.closePage(request.params.pageIdx);
|
|
56
54
|
response.setIncludePages(true);
|
|
57
55
|
},
|
|
58
56
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-devtools-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "MCP server for Chrome DevTools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./build/src/index.js",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"url": "https://github.com/ChromeDevTools/chrome-devtools-mcp/issues"
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/ChromeDevTools/chrome-devtools-mcp#readme",
|
|
36
|
+
"mcpName": "io.github.ChromeDevTools/chrome-devtools-mcp",
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"@modelcontextprotocol/sdk": "1.18.1",
|
|
38
39
|
"debug": "4.4.3",
|