chrometools-mcp 1.9.1 → 2.3.2
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/CHANGELOG.md +305 -0
- package/README.md +279 -53
- package/browser/browser-manager.js +206 -0
- package/browser/page-manager.js +298 -0
- package/index.js +625 -1875
- package/package.json +1 -1
- package/recorder/page-object-generator.js +720 -0
- package/recorder/recorder-script.js +63 -9
- package/recorder/scenario-executor.js +47 -27
- package/recorder/scenario-storage.js +251 -29
- package/server/tool-definitions.js +655 -0
- package/server/tool-schemas.js +295 -0
- package/utils/code-generators/code-generator-base.js +61 -0
- package/utils/code-generators/file-appender.js +202 -0
- package/utils/code-generators/playwright-python.js +84 -0
- package/utils/code-generators/playwright-typescript.js +95 -0
- package/utils/code-generators/selenium-java.js +123 -0
- package/utils/code-generators/selenium-python.js +82 -0
- package/utils/css-utils.js +151 -0
- package/utils/image-processing.js +236 -0
- package/utils/platform-utils.js +62 -0
- package/utils/url-to-project.js +141 -0
- package/utils/project-detector.js +0 -87
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* server/tool-definitions.js
|
|
3
|
+
*
|
|
4
|
+
* MCP tool definitions for ListTools handler
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const toolDefinitions = [
|
|
8
|
+
{
|
|
9
|
+
name: "ping",
|
|
10
|
+
description: "Simple ping-pong tool for testing. Returns 'pong' with optional message.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
message: { type: "string", description: "Optional message to include in response" },
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "openBrowser",
|
|
20
|
+
description: "Open browser and navigate to URL. Window persists for further interactions.",
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
url: { type: "string", description: "URL to navigate to" },
|
|
25
|
+
},
|
|
26
|
+
required: ["url"],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "click",
|
|
31
|
+
description: "Click element. Waits for animations. Optional screenshot parameter.",
|
|
32
|
+
inputSchema: {
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
selector: { type: "string", description: "CSS selector" },
|
|
36
|
+
waitAfter: { type: "number", description: "Wait ms (default: 1500)" },
|
|
37
|
+
screenshot: { type: "boolean", description: "Screenshot (default: false)" },
|
|
38
|
+
timeout: { type: "number", description: "Max wait ms (default: 30000)" },
|
|
39
|
+
},
|
|
40
|
+
required: ["selector"],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "type",
|
|
45
|
+
description: "Type text into input field. Optional clear and typing delay.",
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: "object",
|
|
48
|
+
properties: {
|
|
49
|
+
selector: { type: "string", description: "CSS selector" },
|
|
50
|
+
text: { type: "string", description: "Text to type" },
|
|
51
|
+
delay: { type: "number", description: "Keystroke delay ms (default: 0)" },
|
|
52
|
+
clearFirst: { type: "boolean", description: "Clear first (default: true)" },
|
|
53
|
+
},
|
|
54
|
+
required: ["selector", "text"],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "getElement",
|
|
59
|
+
description: "Get HTML markup of element. Prefer analyzePage for better efficiency.",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: {
|
|
63
|
+
selector: { type: "string", description: "CSS selector (default: body)" },
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "getComputedCss",
|
|
69
|
+
description: "Get computed CSS styles for element. For layout debugging and responsive design.",
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: "object",
|
|
72
|
+
properties: {
|
|
73
|
+
selector: { type: "string", description: "CSS selector (default: body)" },
|
|
74
|
+
category: {
|
|
75
|
+
type: "string",
|
|
76
|
+
enum: ["all", "layout", "typography", "colors", "visual"],
|
|
77
|
+
description: "Filter: 'layout', 'typography', 'colors', 'visual', 'all' (default)"
|
|
78
|
+
},
|
|
79
|
+
properties: {
|
|
80
|
+
type: "array",
|
|
81
|
+
items: { type: "string" },
|
|
82
|
+
description: "Specific properties. Overrides category."
|
|
83
|
+
},
|
|
84
|
+
includeDefaults: {
|
|
85
|
+
type: "boolean",
|
|
86
|
+
description: "Include defaults (default: false)"
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "getBoxModel",
|
|
93
|
+
description: "Get element box model: dimensions, positioning, margins, padding, borders.",
|
|
94
|
+
inputSchema: {
|
|
95
|
+
type: "object",
|
|
96
|
+
properties: {
|
|
97
|
+
selector: { type: "string", description: "CSS selector" },
|
|
98
|
+
},
|
|
99
|
+
required: ["selector"],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "screenshot",
|
|
104
|
+
description: "Capture element image (15-25k tokens). For visual comparison. Use analyzePage for form data/validation (2-5k tokens).",
|
|
105
|
+
inputSchema: {
|
|
106
|
+
type: "object",
|
|
107
|
+
properties: {
|
|
108
|
+
selector: { type: "string", description: "CSS selector" },
|
|
109
|
+
padding: { type: "number", description: "Padding px (default: 0)" },
|
|
110
|
+
maxWidth: { type: "number", description: "Max width px (default: 1024, null=original)" },
|
|
111
|
+
maxHeight: { type: "number", description: "Max height px (default: 8000, null=original)" },
|
|
112
|
+
quality: { type: "number", minimum: 1, maximum: 100, description: "JPEG quality (default: 80)" },
|
|
113
|
+
format: { type: "string", enum: ["png", "jpeg", "auto"], description: "Format (default: auto)" },
|
|
114
|
+
},
|
|
115
|
+
required: ["selector"],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "saveScreenshot",
|
|
120
|
+
description: "Save screenshot to file without returning in context. Auto-scales and compresses. Use maxWidth: null and format: 'png' for original quality.",
|
|
121
|
+
inputSchema: {
|
|
122
|
+
type: "object",
|
|
123
|
+
properties: {
|
|
124
|
+
selector: { type: "string", description: "CSS selector" },
|
|
125
|
+
filePath: { type: "string", description: "Save path (extension auto-adjusted)" },
|
|
126
|
+
padding: { type: "number", description: "Padding px (default: 0)" },
|
|
127
|
+
maxWidth: { type: "number", description: "Max width px (default: 1024, null=original)" },
|
|
128
|
+
maxHeight: { type: "number", description: "Max height px (default: 8000, null=original)" },
|
|
129
|
+
quality: { type: "number", minimum: 1, maximum: 100, description: "JPEG quality (default: 80)" },
|
|
130
|
+
format: { type: "string", enum: ["png", "jpeg", "auto"], description: "Format (default: auto)" },
|
|
131
|
+
},
|
|
132
|
+
required: ["selector", "filePath"],
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "scrollTo",
|
|
137
|
+
description: "Scroll to element. For lazy loading and visibility testing.",
|
|
138
|
+
inputSchema: {
|
|
139
|
+
type: "object",
|
|
140
|
+
properties: {
|
|
141
|
+
selector: { type: "string", description: "CSS selector" },
|
|
142
|
+
behavior: { type: "string", enum: ["auto", "smooth"], description: "Behavior (default: auto)" },
|
|
143
|
+
},
|
|
144
|
+
required: ["selector"],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "waitForElement",
|
|
149
|
+
description: "Wait for element to appear. For dynamic content and lazy-loaded elements.",
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: "object",
|
|
152
|
+
properties: {
|
|
153
|
+
selector: { type: "string", description: "CSS selector" },
|
|
154
|
+
timeout: { type: "number", description: "Max wait ms (default: 5000)" },
|
|
155
|
+
visible: { type: "boolean", description: "Wait for visible (default: true)" },
|
|
156
|
+
},
|
|
157
|
+
required: ["selector"],
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "executeScript",
|
|
162
|
+
description: "Execute JavaScript. Use only when specialized tools insufficient. Prefer analyzePage or findElementsByText.",
|
|
163
|
+
inputSchema: {
|
|
164
|
+
type: "object",
|
|
165
|
+
properties: {
|
|
166
|
+
script: { type: "string", description: "JavaScript code" },
|
|
167
|
+
waitAfter: { type: "number", description: "Wait ms (default: 500)" },
|
|
168
|
+
screenshot: { type: "boolean", description: "Screenshot (default: false)" },
|
|
169
|
+
timeout: { type: "number", description: "Max wait ms (default: 30000)" },
|
|
170
|
+
},
|
|
171
|
+
required: ["script"],
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "getConsoleLogs",
|
|
176
|
+
description: "Get browser console messages. For debugging JS errors and tracking behavior.",
|
|
177
|
+
inputSchema: {
|
|
178
|
+
type: "object",
|
|
179
|
+
properties: {
|
|
180
|
+
types: { type: "array", items: { type: "string", enum: ["log", "warn", "error", "info", "debug", "verbose", "warning"] }, description: "Filter types (default: all)" },
|
|
181
|
+
clear: { type: "boolean", description: "Clear after read (default: false)" },
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "listNetworkRequests",
|
|
187
|
+
description: "List network requests (method, URL, status). Use getNetworkRequest for details. Supports pagination.",
|
|
188
|
+
inputSchema: {
|
|
189
|
+
type: "object",
|
|
190
|
+
properties: {
|
|
191
|
+
types: { type: "array", items: { type: "string", enum: ["Document", "Stylesheet", "Image", "Media", "Font", "Script", "XHR", "Fetch", "WebSocket", "Other"] }, description: "Filter types (default: Fetch, XHR)" },
|
|
192
|
+
status: { type: "string", enum: ["pending", "completed", "failed", "all"], description: "Filter status (default: all)" },
|
|
193
|
+
limit: { type: "number", description: "Max requests (default: 50)" },
|
|
194
|
+
offset: { type: "number", description: "Skip requests (default: 0)" },
|
|
195
|
+
clear: { type: "boolean", description: "Clear after read (default: false)" },
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "getNetworkRequest",
|
|
201
|
+
description: "Get network request details (headers, payload, response). Use requestId from listNetworkRequests.",
|
|
202
|
+
inputSchema: {
|
|
203
|
+
type: "object",
|
|
204
|
+
properties: {
|
|
205
|
+
requestId: { type: "string", description: "Request ID" },
|
|
206
|
+
},
|
|
207
|
+
required: ["requestId"],
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "filterNetworkRequests",
|
|
212
|
+
description: "Filter network requests by URL pattern. Returns matching requests with full details.",
|
|
213
|
+
inputSchema: {
|
|
214
|
+
type: "object",
|
|
215
|
+
properties: {
|
|
216
|
+
urlPattern: { type: "string", description: "URL pattern (regex or partial)" },
|
|
217
|
+
types: { type: "array", items: { type: "string", enum: ["Document", "Stylesheet", "Image", "Media", "Font", "Script", "XHR", "Fetch", "WebSocket", "Other"] }, description: "Filter types (default: Fetch, XHR)" },
|
|
218
|
+
clear: { type: "boolean", description: "Clear after read (default: false)" },
|
|
219
|
+
},
|
|
220
|
+
required: ["urlPattern"],
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "hover",
|
|
225
|
+
description: "Hover over element. For testing hover effects, tooltips, and CSS :hover states.",
|
|
226
|
+
inputSchema: {
|
|
227
|
+
type: "object",
|
|
228
|
+
properties: {
|
|
229
|
+
selector: { type: "string", description: "CSS selector" },
|
|
230
|
+
},
|
|
231
|
+
required: ["selector"],
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: "setStyles",
|
|
236
|
+
description: "Apply inline CSS to element. For live editing and prototyping.",
|
|
237
|
+
inputSchema: {
|
|
238
|
+
type: "object",
|
|
239
|
+
properties: {
|
|
240
|
+
selector: { type: "string", description: "CSS selector" },
|
|
241
|
+
styles: {
|
|
242
|
+
type: "array",
|
|
243
|
+
items: {
|
|
244
|
+
type: "object",
|
|
245
|
+
properties: {
|
|
246
|
+
name: { type: "string", description: "Property name" },
|
|
247
|
+
value: { type: "string", description: "Property value" },
|
|
248
|
+
},
|
|
249
|
+
required: ["name", "value"],
|
|
250
|
+
},
|
|
251
|
+
description: "CSS property name-value pairs",
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
required: ["selector", "styles"],
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: "setViewport",
|
|
259
|
+
description: "Change viewport dimensions. Test responsive layouts across screen sizes.",
|
|
260
|
+
inputSchema: {
|
|
261
|
+
type: "object",
|
|
262
|
+
properties: {
|
|
263
|
+
width: { type: "number", minimum: 320, maximum: 4000, description: "Width px" },
|
|
264
|
+
height: { type: "number", minimum: 200, maximum: 3000, description: "Height px" },
|
|
265
|
+
deviceScaleFactor: { type: "number", minimum: 0.5, maximum: 3, description: "Pixel ratio (default: 1)" },
|
|
266
|
+
},
|
|
267
|
+
required: ["width", "height"],
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
name: "getViewport",
|
|
272
|
+
description: "Get viewport size and pixel ratio. For responsive design testing.",
|
|
273
|
+
inputSchema: {
|
|
274
|
+
type: "object",
|
|
275
|
+
properties: {},
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
name: "navigateTo",
|
|
280
|
+
description: "Navigate to new URL. Reuses browser instance.",
|
|
281
|
+
inputSchema: {
|
|
282
|
+
type: "object",
|
|
283
|
+
properties: {
|
|
284
|
+
url: { type: "string", description: "URL to navigate to" },
|
|
285
|
+
waitUntil: { type: "string", enum: ["load", "domcontentloaded", "networkidle0", "networkidle2"], description: "Wait event (default: networkidle2)" },
|
|
286
|
+
},
|
|
287
|
+
required: ["url"],
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
name: "getFigmaFrame",
|
|
292
|
+
description: "Export Figma frame as PNG. Requires API token and file/node IDs.",
|
|
293
|
+
inputSchema: {
|
|
294
|
+
type: "object",
|
|
295
|
+
properties: {
|
|
296
|
+
figmaToken: { type: "string", description: "API token (optional)" },
|
|
297
|
+
fileKey: { type: "string", description: "File key" },
|
|
298
|
+
nodeId: { type: "string", description: "Frame/component ID" },
|
|
299
|
+
scale: { type: "number", minimum: 0.1, maximum: 4, description: "Scale (default: 2)" },
|
|
300
|
+
format: { type: "string", enum: ["png", "jpg", "svg"], description: "Format (default: png)" },
|
|
301
|
+
},
|
|
302
|
+
required: ["fileKey", "nodeId"],
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
name: "compareFigmaToElement",
|
|
307
|
+
description: "Compare Figma design with browser element. Pixel-perfect validation.",
|
|
308
|
+
inputSchema: {
|
|
309
|
+
type: "object",
|
|
310
|
+
properties: {
|
|
311
|
+
figmaToken: { type: "string", description: "API token (optional)" },
|
|
312
|
+
fileKey: { type: "string", description: "File key" },
|
|
313
|
+
nodeId: { type: "string", description: "Frame/component ID" },
|
|
314
|
+
selector: { type: "string", description: "CSS selector" },
|
|
315
|
+
threshold: { type: "number", minimum: 0, maximum: 1, description: "Diff threshold (default: 0.05)" },
|
|
316
|
+
figmaScale: { type: "number", minimum: 0.1, maximum: 4, description: "Scale (default: 2)" },
|
|
317
|
+
},
|
|
318
|
+
required: ["fileKey", "nodeId", "selector"],
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: "getFigmaSpecs",
|
|
323
|
+
description: "Extract design specs from Figma: colors, fonts, dimensions, spacing.",
|
|
324
|
+
inputSchema: {
|
|
325
|
+
type: "object",
|
|
326
|
+
properties: {
|
|
327
|
+
figmaToken: { type: "string", description: "API token (optional)" },
|
|
328
|
+
fileKey: { type: "string", description: "File key" },
|
|
329
|
+
nodeId: { type: "string", description: "Frame/component ID" },
|
|
330
|
+
},
|
|
331
|
+
required: ["fileKey", "nodeId"],
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: "parseFigmaUrl",
|
|
336
|
+
description: "Parse Figma URL to extract fileKey and nodeId.",
|
|
337
|
+
inputSchema: {
|
|
338
|
+
type: "object",
|
|
339
|
+
properties: {
|
|
340
|
+
url: { type: "string", description: "Figma URL or fileKey" },
|
|
341
|
+
},
|
|
342
|
+
required: ["url"],
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: "listFigmaPages",
|
|
347
|
+
description: "Get file structure: all pages and frames. Use first to discover file contents.",
|
|
348
|
+
inputSchema: {
|
|
349
|
+
type: "object",
|
|
350
|
+
properties: {
|
|
351
|
+
figmaToken: { type: "string", description: "API token (optional)" },
|
|
352
|
+
fileKey: { type: "string", description: "File key or URL" },
|
|
353
|
+
},
|
|
354
|
+
required: ["fileKey"],
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
name: "searchFigmaFrames",
|
|
359
|
+
description: "Search frames/components by name. Case-insensitive across all pages.",
|
|
360
|
+
inputSchema: {
|
|
361
|
+
type: "object",
|
|
362
|
+
properties: {
|
|
363
|
+
figmaToken: { type: "string", description: "API token (optional)" },
|
|
364
|
+
fileKey: { type: "string", description: "File key or URL" },
|
|
365
|
+
searchQuery: { type: "string", description: "Search query" },
|
|
366
|
+
},
|
|
367
|
+
required: ["fileKey", "searchQuery"],
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
name: "getFigmaComponents",
|
|
372
|
+
description: "Get all components from file (Design System). For extracting design system.",
|
|
373
|
+
inputSchema: {
|
|
374
|
+
type: "object",
|
|
375
|
+
properties: {
|
|
376
|
+
figmaToken: { type: "string", description: "API token (optional)" },
|
|
377
|
+
fileKey: { type: "string", description: "File key or URL" },
|
|
378
|
+
},
|
|
379
|
+
required: ["fileKey"],
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: "getFigmaStyles",
|
|
384
|
+
description: "Get all styles: color, text, effect, grid. For extracting design tokens.",
|
|
385
|
+
inputSchema: {
|
|
386
|
+
type: "object",
|
|
387
|
+
properties: {
|
|
388
|
+
figmaToken: { type: "string", description: "API token (optional)" },
|
|
389
|
+
fileKey: { type: "string", description: "File key or URL" },
|
|
390
|
+
},
|
|
391
|
+
required: ["fileKey"],
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: "getFigmaColorPalette",
|
|
396
|
+
description: "Extract color palette. Returns unique colors with hex, rgba, usage count.",
|
|
397
|
+
inputSchema: {
|
|
398
|
+
type: "object",
|
|
399
|
+
properties: {
|
|
400
|
+
figmaToken: { type: "string", description: "API token (optional)" },
|
|
401
|
+
fileKey: { type: "string", description: "File key or URL" },
|
|
402
|
+
},
|
|
403
|
+
required: ["fileKey"],
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
name: "smartFindElement",
|
|
408
|
+
description: "Find elements with natural language. Returns ranked candidates. Prefer analyzePage for better performance.",
|
|
409
|
+
inputSchema: {
|
|
410
|
+
type: "object",
|
|
411
|
+
properties: {
|
|
412
|
+
description: { type: "string", description: "Natural language description" },
|
|
413
|
+
maxResults: { type: "number", minimum: 1, maximum: 20, description: "Max candidates (default: 5)" },
|
|
414
|
+
action: {
|
|
415
|
+
type: "object",
|
|
416
|
+
properties: {
|
|
417
|
+
type: { type: "string", enum: ["click", "type", "scrollTo", "screenshot", "hover", "setStyles"], description: "Action type" },
|
|
418
|
+
text: { type: "string", description: "Text for 'type'" },
|
|
419
|
+
styles: { type: "array", items: { type: "object", properties: { name: { type: "string" }, value: { type: "string" } } }, description: "Styles for 'setStyles'" },
|
|
420
|
+
screenshot: { type: "boolean", description: "Screenshot (default: false)" },
|
|
421
|
+
waitAfter: { type: "number", description: "Wait ms" },
|
|
422
|
+
},
|
|
423
|
+
required: ["type"],
|
|
424
|
+
description: "Optional action on element",
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
required: ["description"],
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
name: "analyzePage",
|
|
432
|
+
description: "Get page state: forms, inputs, buttons, links with values. Use refresh:true after interactions. Cached per URL. 2-5k tokens vs screenshot 15-25k.",
|
|
433
|
+
inputSchema: {
|
|
434
|
+
type: "object",
|
|
435
|
+
properties: {
|
|
436
|
+
refresh: { type: "boolean", description: "Refresh cache (default: false)" },
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
name: "getAllInteractiveElements",
|
|
442
|
+
description: "Get all interactive elements with selectors. For understanding available actions.",
|
|
443
|
+
inputSchema: {
|
|
444
|
+
type: "object",
|
|
445
|
+
properties: {
|
|
446
|
+
includeHidden: { type: "boolean", description: "Include hidden (default: false)" },
|
|
447
|
+
},
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
name: "findElementsByText",
|
|
452
|
+
description: "Find elements by text. Returns elements with selectors. Optional actions on first match.",
|
|
453
|
+
inputSchema: {
|
|
454
|
+
type: "object",
|
|
455
|
+
properties: {
|
|
456
|
+
text: { type: "string", description: "Search text" },
|
|
457
|
+
exact: { type: "boolean", description: "Exact match (default: false)" },
|
|
458
|
+
caseSensitive: { type: "boolean", description: "Case sensitive (default: false)" },
|
|
459
|
+
action: {
|
|
460
|
+
type: "object",
|
|
461
|
+
properties: {
|
|
462
|
+
type: { type: "string", enum: ["click", "type", "scrollTo", "screenshot", "hover", "setStyles"], description: "Action type" },
|
|
463
|
+
text: { type: "string", description: "Text for 'type'" },
|
|
464
|
+
styles: { type: "array", items: { type: "object", properties: { name: { type: "string" }, value: { type: "string" } } }, description: "Styles for 'setStyles'" },
|
|
465
|
+
screenshot: { type: "boolean", description: "Screenshot (default: false)" },
|
|
466
|
+
waitAfter: { type: "number", description: "Wait ms" },
|
|
467
|
+
},
|
|
468
|
+
required: ["type"],
|
|
469
|
+
description: "Optional action on first match",
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
required: ["text"],
|
|
473
|
+
},
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
name: "enableRecorder",
|
|
477
|
+
description: "Inject recorder UI widget. Visual recording with start/stop/save controls. Scenarios are stored in ~/.config/chrometools-mcp/projects/{projectName}/scenarios/. Use global index at ~/.config/chrometools-mcp/index.json to discover available projects and scenarios.",
|
|
478
|
+
inputSchema: {
|
|
479
|
+
type: "object",
|
|
480
|
+
properties: {},
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
name: "executeScenario",
|
|
485
|
+
description: "Execute recorded scenario by name. Runs actions with dependency resolution. Scenarios are organized by domain in ~/.config/chrometools-mcp/projects/{domain}/scenarios/. If multiple scenarios have the same name across different domains, specify projectId to disambiguate.",
|
|
486
|
+
inputSchema: {
|
|
487
|
+
type: "object",
|
|
488
|
+
properties: {
|
|
489
|
+
name: { type: "string", description: "Scenario name" },
|
|
490
|
+
projectId: { type: "string", description: "Optional: Project ID (domain) to disambiguate scenarios with same name. Examples: 'google', 'localhost-3000'" },
|
|
491
|
+
parameters: { type: "object", description: "Execution parameters" },
|
|
492
|
+
executeDependencies: { type: "boolean", description: "Execute dependencies (default: true)" },
|
|
493
|
+
},
|
|
494
|
+
required: ["name"],
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: "listScenarios",
|
|
499
|
+
description: "List all scenarios with metadata. Scenarios are stored in ~/.config/chrometools-mcp/projects/{projectName}/scenarios/. Use global index at ~/.config/chrometools-mcp/index.json to discover available projects and scenarios.",
|
|
500
|
+
inputSchema: {
|
|
501
|
+
type: "object",
|
|
502
|
+
properties: {
|
|
503
|
+
allProjects: { type: "boolean", description: "List scenarios from all projects (default: false, shows only current project)" },
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
name: "searchScenarios",
|
|
509
|
+
description: "Search scenarios by text or tags. Scenarios are stored in ~/.config/chrometools-mcp/projects/{projectName}/scenarios/. Use global index at ~/.config/chrometools-mcp/index.json to discover available projects and scenarios.",
|
|
510
|
+
inputSchema: {
|
|
511
|
+
type: "object",
|
|
512
|
+
properties: {
|
|
513
|
+
text: { type: "string", description: "Search text" },
|
|
514
|
+
tags: { type: "array", items: { type: "string" }, description: "Filter tags" },
|
|
515
|
+
allProjects: { type: "boolean", description: "Search in all projects (default: false, searches only current project)" },
|
|
516
|
+
},
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
name: "getScenarioInfo",
|
|
521
|
+
description: "Get scenario details: actions, parameters, dependencies. Scenarios are stored in ~/.config/chrometools-mcp/projects/{projectName}/scenarios/. Use global index at ~/.config/chrometools-mcp/index.json to discover available projects and scenarios.",
|
|
522
|
+
inputSchema: {
|
|
523
|
+
type: "object",
|
|
524
|
+
properties: {
|
|
525
|
+
name: { type: "string", description: "Scenario name" },
|
|
526
|
+
includeSecrets: { type: "boolean", description: "Include secrets (default: false)" },
|
|
527
|
+
},
|
|
528
|
+
required: ["name"],
|
|
529
|
+
},
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
name: "deleteScenario",
|
|
533
|
+
description: "Delete scenario and secrets. Scenarios are stored in ~/.config/chrometools-mcp/projects/{projectName}/scenarios/. Use global index at ~/.config/chrometools-mcp/index.json to discover available projects and scenarios.",
|
|
534
|
+
inputSchema: {
|
|
535
|
+
type: "object",
|
|
536
|
+
properties: {
|
|
537
|
+
name: { type: "string", description: "Scenario name" },
|
|
538
|
+
},
|
|
539
|
+
required: ["name"],
|
|
540
|
+
},
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
name: "exportScenarioAsCode",
|
|
544
|
+
description: "Export recorded scenario as executable test code for creating a NEW test file. Automatically cleans unstable selectors (CSS modules, styled-components). Optionally generates Page Object class. Returns JSON with code and suggested filename - Claude Code will create the file. To add tests to EXISTING files, use 'appendScenarioToFile' instead. Scenarios are stored in ~/.config/chrometools-mcp/projects/{projectName}/scenarios/. Use global index at ~/.config/chrometools-mcp/index.json to discover available projects and scenarios.",
|
|
545
|
+
inputSchema: {
|
|
546
|
+
type: "object",
|
|
547
|
+
properties: {
|
|
548
|
+
scenarioName: {
|
|
549
|
+
type: "string",
|
|
550
|
+
description: "Name of scenario to export"
|
|
551
|
+
},
|
|
552
|
+
language: {
|
|
553
|
+
type: "string",
|
|
554
|
+
enum: ["playwright-typescript", "playwright-python", "selenium-python", "selenium-java"],
|
|
555
|
+
description: "Target test framework and language"
|
|
556
|
+
},
|
|
557
|
+
cleanSelectors: {
|
|
558
|
+
type: "boolean",
|
|
559
|
+
description: "Remove unstable CSS classes (default: true)"
|
|
560
|
+
},
|
|
561
|
+
includeComments: {
|
|
562
|
+
type: "boolean",
|
|
563
|
+
description: "Include descriptive comments (default: true)"
|
|
564
|
+
},
|
|
565
|
+
generatePageObject: {
|
|
566
|
+
type: "boolean",
|
|
567
|
+
description: "Also generate Page Object class for the page (default: false)"
|
|
568
|
+
},
|
|
569
|
+
pageObjectClassName: {
|
|
570
|
+
type: "string",
|
|
571
|
+
description: "Page Object class name (optional, auto-generated if not provided)"
|
|
572
|
+
},
|
|
573
|
+
},
|
|
574
|
+
required: ["scenarioName", "language"],
|
|
575
|
+
},
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
name: "appendScenarioToFile",
|
|
579
|
+
description: "Append recorded scenario as test code to an EXISTING test file. Automatically cleans unstable selectors (CSS modules, styled-components). Optionally generates Page Object class. Returns JSON with test code and target file - Claude Code will append to the file without overwriting existing tests. To create NEW test files, use 'exportScenarioAsCode' instead. Scenarios are stored in ~/.config/chrometools-mcp/projects/{projectName}/scenarios/. Use global index at ~/.config/chrometools-mcp/index.json to discover available projects and scenarios.",
|
|
580
|
+
inputSchema: {
|
|
581
|
+
type: "object",
|
|
582
|
+
properties: {
|
|
583
|
+
scenarioName: {
|
|
584
|
+
type: "string",
|
|
585
|
+
description: "Name of scenario to export"
|
|
586
|
+
},
|
|
587
|
+
language: {
|
|
588
|
+
type: "string",
|
|
589
|
+
enum: ["playwright-typescript", "playwright-python", "selenium-python", "selenium-java"],
|
|
590
|
+
description: "Target test framework and language"
|
|
591
|
+
},
|
|
592
|
+
targetFile: {
|
|
593
|
+
type: "string",
|
|
594
|
+
description: "Path to existing test file to append to (REQUIRED)"
|
|
595
|
+
},
|
|
596
|
+
testName: {
|
|
597
|
+
type: "string",
|
|
598
|
+
description: "Override test name (default: from scenario name)"
|
|
599
|
+
},
|
|
600
|
+
insertPosition: {
|
|
601
|
+
type: "string",
|
|
602
|
+
enum: ["end", "before", "after"],
|
|
603
|
+
description: "Where to insert test: 'end' (default - after all tests), 'before' (before reference test), or 'after' (after reference test)"
|
|
604
|
+
},
|
|
605
|
+
referenceTestName: {
|
|
606
|
+
type: "string",
|
|
607
|
+
description: "Reference test name for 'before'/'after' insertion. Required when insertPosition is 'before' or 'after'"
|
|
608
|
+
},
|
|
609
|
+
cleanSelectors: {
|
|
610
|
+
type: "boolean",
|
|
611
|
+
description: "Remove unstable CSS classes (default: true)"
|
|
612
|
+
},
|
|
613
|
+
includeComments: {
|
|
614
|
+
type: "boolean",
|
|
615
|
+
description: "Include descriptive comments (default: true)"
|
|
616
|
+
},
|
|
617
|
+
generatePageObject: {
|
|
618
|
+
type: "boolean",
|
|
619
|
+
description: "Also generate Page Object class for the page (default: false)"
|
|
620
|
+
},
|
|
621
|
+
pageObjectClassName: {
|
|
622
|
+
type: "string",
|
|
623
|
+
description: "Page Object class name (optional, auto-generated if not provided)"
|
|
624
|
+
},
|
|
625
|
+
},
|
|
626
|
+
required: ["scenarioName", "language", "targetFile"],
|
|
627
|
+
},
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
name: "generatePageObject",
|
|
631
|
+
description: "Generate Page Object Model (POM) class from current page analysis. Analyzes page structure, extracts interactive elements (inputs, buttons, links), groups them by sections (header, nav, form, etc.), and generates framework-specific code. Supports Playwright (TypeScript/Python) and Selenium (Python/Java). Auto-generates smart element names and helper methods.",
|
|
632
|
+
inputSchema: {
|
|
633
|
+
type: "object",
|
|
634
|
+
properties: {
|
|
635
|
+
className: {
|
|
636
|
+
type: "string",
|
|
637
|
+
description: "Page Object class name (optional, auto-generated from page title/URL if not provided)"
|
|
638
|
+
},
|
|
639
|
+
framework: {
|
|
640
|
+
type: "string",
|
|
641
|
+
enum: ["playwright-typescript", "playwright-python", "selenium-python", "selenium-java"],
|
|
642
|
+
description: "Target test framework (default: playwright-typescript)"
|
|
643
|
+
},
|
|
644
|
+
includeComments: {
|
|
645
|
+
type: "boolean",
|
|
646
|
+
description: "Include descriptive comments in generated code (default: true)"
|
|
647
|
+
},
|
|
648
|
+
groupElements: {
|
|
649
|
+
type: "boolean",
|
|
650
|
+
description: "Group elements by page sections (default: true)"
|
|
651
|
+
},
|
|
652
|
+
},
|
|
653
|
+
},
|
|
654
|
+
},
|
|
655
|
+
];
|