@probebrowser/trace-mcp 1.1.1 → 1.3.0
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/dist/server.js +34 -5
- package/dist/tools.js +11 -0
- package/package.json +2 -2
- package/src/server.ts +35 -5
- package/src/tools.ts +11 -0
package/dist/server.js
CHANGED
|
@@ -137,7 +137,28 @@ export class TraceMcpServer {
|
|
|
137
137
|
]
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
// 3. Handle
|
|
140
|
+
// 3. Handle Screenshot Tool — return MCP image content
|
|
141
|
+
if (toolDef.method === 'take_screenshot') {
|
|
142
|
+
result = await this.trace.tool(toolDef.method, (request.params.arguments || {}));
|
|
143
|
+
const data = result?.data;
|
|
144
|
+
if (data?.base64) {
|
|
145
|
+
return {
|
|
146
|
+
content: [
|
|
147
|
+
{
|
|
148
|
+
type: 'image',
|
|
149
|
+
data: data.base64,
|
|
150
|
+
mimeType: 'image/png',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: 'text',
|
|
154
|
+
text: `Screenshot captured (${data.sizeKB}KB${data.selector ? `, element: ${data.selector}` : data.fullPage ? ', full page' : ', viewport'})`,
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
160
|
+
}
|
|
161
|
+
// 4. Handle Standard SDK Tools
|
|
141
162
|
result = await this.trace.tool(toolDef.method, (request.params.arguments || {}));
|
|
142
163
|
return {
|
|
143
164
|
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
@@ -230,10 +251,18 @@ export class TraceMcpServer {
|
|
|
230
251
|
}
|
|
231
252
|
// --- Screenshot ---
|
|
232
253
|
if (uri === 'trace://screenshot') {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
254
|
+
const result = await this.trace.tool('take_screenshot', {});
|
|
255
|
+
const data = result?.data;
|
|
256
|
+
if (data?.base64) {
|
|
257
|
+
return {
|
|
258
|
+
contents: [{
|
|
259
|
+
uri,
|
|
260
|
+
mimeType: 'image/png',
|
|
261
|
+
blob: data.base64,
|
|
262
|
+
}],
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
return { contents: [{ uri, mimeType: 'text/plain', text: 'Screenshot capture failed' }] };
|
|
237
266
|
}
|
|
238
267
|
throw new Error(`Resource not found: ${uri}`);
|
|
239
268
|
});
|
package/dist/tools.js
CHANGED
|
@@ -950,4 +950,15 @@ export const TOOLS = {
|
|
|
950
950
|
prompt: z.string().describe('The debugging question/goal'),
|
|
951
951
|
}),
|
|
952
952
|
},
|
|
953
|
+
// ============================================
|
|
954
|
+
// SCREENSHOT (1)
|
|
955
|
+
// ============================================
|
|
956
|
+
trace_take_screenshot: {
|
|
957
|
+
method: 'take_screenshot',
|
|
958
|
+
description: 'Capture a PNG screenshot of the current page. Returns base64 image data directly viewable by the AI. Use this to see the actual rendered UI, verify layout changes, check visual bugs, or compare before/after states.',
|
|
959
|
+
schema: z.object({
|
|
960
|
+
fullPage: z.boolean().optional().describe('Capture full scrollable page (default: viewport only)'),
|
|
961
|
+
selector: z.string().optional().describe('CSS selector to capture only that element'),
|
|
962
|
+
}),
|
|
963
|
+
},
|
|
953
964
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@probebrowser/trace-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Trace MCP - Bridge between AI Agents and Trace",
|
|
5
5
|
"homepage": "https://trace.probebrowser.com/",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
21
|
-
"@probebrowser/sdk": "^2.0
|
|
21
|
+
"@probebrowser/sdk": "^2.2.0",
|
|
22
22
|
"@types/cors": "^2.8.19",
|
|
23
23
|
"@types/express": "^5.0.6",
|
|
24
24
|
"cors": "^2.8.6",
|
package/src/server.ts
CHANGED
|
@@ -172,7 +172,29 @@ export class TraceMcpServer {
|
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
// 3. Handle
|
|
175
|
+
// 3. Handle Screenshot Tool — return MCP image content
|
|
176
|
+
if (toolDef.method === 'take_screenshot') {
|
|
177
|
+
result = await this.trace.tool(toolDef.method, (request.params.arguments || {}) as Record<string, unknown>);
|
|
178
|
+
const data = result?.data as any;
|
|
179
|
+
if (data?.base64) {
|
|
180
|
+
return {
|
|
181
|
+
content: [
|
|
182
|
+
{
|
|
183
|
+
type: 'image' as const,
|
|
184
|
+
data: data.base64,
|
|
185
|
+
mimeType: 'image/png',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'text',
|
|
189
|
+
text: `Screenshot captured (${data.sizeKB}KB${data.selector ? `, element: ${data.selector}` : data.fullPage ? ', full page' : ', viewport'})`,
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// 4. Handle Standard SDK Tools
|
|
176
198
|
result = await this.trace.tool(toolDef.method, (request.params.arguments || {}) as Record<string, unknown>);
|
|
177
199
|
|
|
178
200
|
return {
|
|
@@ -271,10 +293,18 @@ export class TraceMcpServer {
|
|
|
271
293
|
|
|
272
294
|
// --- Screenshot ---
|
|
273
295
|
if (uri === 'trace://screenshot') {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
296
|
+
const result = await this.trace.tool('take_screenshot', {});
|
|
297
|
+
const data = result?.data as any;
|
|
298
|
+
if (data?.base64) {
|
|
299
|
+
return {
|
|
300
|
+
contents: [{
|
|
301
|
+
uri,
|
|
302
|
+
mimeType: 'image/png',
|
|
303
|
+
blob: data.base64,
|
|
304
|
+
}],
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
return { contents: [{ uri, mimeType: 'text/plain', text: 'Screenshot capture failed' }] };
|
|
278
308
|
}
|
|
279
309
|
|
|
280
310
|
throw new Error(`Resource not found: ${uri}`);
|
package/src/tools.ts
CHANGED
|
@@ -966,4 +966,15 @@ export const TOOLS = {
|
|
|
966
966
|
prompt: z.string().describe('The debugging question/goal'),
|
|
967
967
|
}),
|
|
968
968
|
},
|
|
969
|
+
// ============================================
|
|
970
|
+
// SCREENSHOT (1)
|
|
971
|
+
// ============================================
|
|
972
|
+
trace_take_screenshot: {
|
|
973
|
+
method: 'take_screenshot',
|
|
974
|
+
description: 'Capture a PNG screenshot of the current page. Returns base64 image data directly viewable by the AI. Use this to see the actual rendered UI, verify layout changes, check visual bugs, or compare before/after states.',
|
|
975
|
+
schema: z.object({
|
|
976
|
+
fullPage: z.boolean().optional().describe('Capture full scrollable page (default: viewport only)'),
|
|
977
|
+
selector: z.string().optional().describe('CSS selector to capture only that element'),
|
|
978
|
+
}),
|
|
979
|
+
},
|
|
969
980
|
};
|