@mcp-b/chrome-devtools-mcp 1.5.4 → 1.5.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/main.js +1 -1
- package/build/src/tools/webmcp.js +63 -20
- package/package.json +1 -1
package/build/src/main.js
CHANGED
|
@@ -22,7 +22,7 @@ import { WebMCPToolHub } from './tools/WebMCPToolHub.js';
|
|
|
22
22
|
* @remarks If moved, update release-please config.
|
|
23
23
|
*/
|
|
24
24
|
// x-release-please-start-version
|
|
25
|
-
const VERSION = '1.5.
|
|
25
|
+
const VERSION = '1.5.5';
|
|
26
26
|
// x-release-please-end
|
|
27
27
|
process.on('unhandledRejection', (reason, promise) => {
|
|
28
28
|
logger('Unhandled promise rejection', promise, reason);
|
|
@@ -117,22 +117,34 @@ export const listWebMCPTools = defineTool({
|
|
|
117
117
|
response.appendResponseLine('Navigate to a page with @mcp-b/global loaded to discover tools.');
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
response.appendResponseLine(
|
|
120
|
+
response.appendResponseLine(`Found ${tools.length} WebMCP tool(s):`);
|
|
121
121
|
response.appendResponseLine('');
|
|
122
|
+
// Group tools by page
|
|
123
|
+
const toolsByPage = new Map();
|
|
122
124
|
for (const tool of tools) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
if (!toolsByPage.has(tool.pageIdx)) {
|
|
126
|
+
toolsByPage.set(tool.pageIdx, []);
|
|
127
|
+
}
|
|
128
|
+
toolsByPage.get(tool.pageIdx).push(tool);
|
|
129
|
+
}
|
|
130
|
+
// Sort pages by index
|
|
131
|
+
const sortedPages = Array.from(toolsByPage.keys()).sort((a, b) => a - b);
|
|
132
|
+
for (const pageIdx of sortedPages) {
|
|
133
|
+
const pageTools = toolsByPage.get(pageIdx);
|
|
134
|
+
const domain = pageTools[0].domain;
|
|
135
|
+
response.appendResponseLine(`Page ${pageIdx}: ${domain}`);
|
|
136
|
+
for (const tool of pageTools) {
|
|
137
|
+
response.appendResponseLine(` • ${tool.originalName}`);
|
|
138
|
+
if (tool.description) {
|
|
139
|
+
response.appendResponseLine(` ${tool.description}`);
|
|
140
|
+
}
|
|
126
141
|
}
|
|
127
|
-
response.appendResponseLine(` Domain: ${tool.domain} (page ${tool.pageIdx})`);
|
|
128
|
-
response.appendResponseLine(` Full ID: ${tool.toolId}`);
|
|
129
142
|
response.appendResponseLine('');
|
|
130
143
|
}
|
|
131
|
-
response.appendResponseLine('
|
|
144
|
+
response.appendResponseLine('To call a tool: call_webmcp_tool({ name: "tool_name", arguments: {...} })');
|
|
132
145
|
if (tools.length > 0) {
|
|
133
146
|
response.appendResponseLine(`Example: call_webmcp_tool({ name: "${tools[0].originalName}" })`);
|
|
134
147
|
}
|
|
135
|
-
response.appendResponseLine('NOT: call_webmcp_tool({ name: "webmcp_localhost_..." })');
|
|
136
148
|
return;
|
|
137
149
|
}
|
|
138
150
|
// Subsequent calls: return diff
|
|
@@ -141,30 +153,61 @@ export const listWebMCPTools = defineTool({
|
|
|
141
153
|
toolHub.setLastSeenToolIds(currentToolIds);
|
|
142
154
|
if (added.length === 0 && removed.length === 0) {
|
|
143
155
|
response.appendResponseLine('No changes since last poll.');
|
|
156
|
+
response.appendResponseLine('');
|
|
144
157
|
if (tools.length > 0) {
|
|
145
|
-
|
|
146
|
-
|
|
158
|
+
// Group tools by page
|
|
159
|
+
const toolsByPage = new Map();
|
|
160
|
+
for (const tool of tools) {
|
|
161
|
+
if (!toolsByPage.has(tool.pageIdx)) {
|
|
162
|
+
toolsByPage.set(tool.pageIdx, []);
|
|
163
|
+
}
|
|
164
|
+
toolsByPage.get(tool.pageIdx).push(tool);
|
|
165
|
+
}
|
|
166
|
+
response.appendResponseLine(`${tools.length} tool(s) available:`);
|
|
167
|
+
const sortedPages = Array.from(toolsByPage.keys()).sort((a, b) => a - b);
|
|
168
|
+
for (const pageIdx of sortedPages) {
|
|
169
|
+
const pageTools = toolsByPage.get(pageIdx);
|
|
170
|
+
const toolNames = pageTools.map(t => t.originalName).join(', ');
|
|
171
|
+
response.appendResponseLine(` Page ${pageIdx}: ${toolNames}`);
|
|
172
|
+
}
|
|
147
173
|
}
|
|
148
174
|
return;
|
|
149
175
|
}
|
|
150
176
|
if (added.length > 0) {
|
|
151
|
-
response.appendResponseLine(`Added
|
|
177
|
+
response.appendResponseLine(`Added ${added.length} new tool(s):`);
|
|
178
|
+
response.appendResponseLine('');
|
|
179
|
+
// Group by page
|
|
180
|
+
const addedByPage = new Map();
|
|
152
181
|
for (const tool of added) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
response.appendResponseLine(` ${tool.description}`);
|
|
182
|
+
if (!addedByPage.has(tool.pageIdx)) {
|
|
183
|
+
addedByPage.set(tool.pageIdx, []);
|
|
156
184
|
}
|
|
157
|
-
|
|
185
|
+
addedByPage.get(tool.pageIdx).push(tool);
|
|
158
186
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
187
|
+
const sortedPages = Array.from(addedByPage.keys()).sort((a, b) => a - b);
|
|
188
|
+
for (const pageIdx of sortedPages) {
|
|
189
|
+
const pageTools = addedByPage.get(pageIdx);
|
|
190
|
+
const domain = pageTools[0].domain;
|
|
191
|
+
response.appendResponseLine(`Page ${pageIdx}: ${domain}`);
|
|
192
|
+
for (const tool of pageTools) {
|
|
193
|
+
response.appendResponseLine(` + ${tool.originalName}`);
|
|
194
|
+
if (tool.description) {
|
|
195
|
+
response.appendResponseLine(` ${tool.description}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
response.appendResponseLine('');
|
|
199
|
+
}
|
|
200
|
+
response.appendResponseLine(`Call with: call_webmcp_tool({ name: "${added[0].originalName}" })`);
|
|
162
201
|
response.appendResponseLine('');
|
|
163
202
|
}
|
|
164
203
|
if (removed.length > 0) {
|
|
165
|
-
response.appendResponseLine(`Removed
|
|
204
|
+
response.appendResponseLine(`Removed ${removed.length} tool(s)`);
|
|
205
|
+
response.appendResponseLine('');
|
|
166
206
|
for (const id of removed) {
|
|
167
|
-
|
|
207
|
+
// Extract original name from toolId format: webmcp_{domain}_page{idx}_{name}
|
|
208
|
+
const parts = id.split('_');
|
|
209
|
+
const name = parts.slice(3).join('_'); // Everything after page index
|
|
210
|
+
response.appendResponseLine(` - ${name || id}`);
|
|
168
211
|
}
|
|
169
212
|
}
|
|
170
213
|
},
|