chrometools-mcp 2.4.2 → 2.5.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.
@@ -28,7 +28,7 @@ export const toolDefinitions = [
28
28
  },
29
29
  {
30
30
  name: "click",
31
- description: "Click element. Waits for animations. Optional screenshot parameter.",
31
+ description: "PRIMARY tool for clicking elements. Works correctly with React/Vue/Angular synthetic events. DO NOT use executeScript for clicks - use this tool instead. Waits for animations and navigation.",
32
32
  inputSchema: {
33
33
  type: "object",
34
34
  properties: {
@@ -42,7 +42,7 @@ export const toolDefinitions = [
42
42
  },
43
43
  {
44
44
  name: "type",
45
- description: "Type text into input field. Optional clear and typing delay.",
45
+ description: "PRIMARY tool for filling input fields. Works correctly with React/Vue/Angular state management. DO NOT use executeScript for typing - use this tool instead. Automatically updates framework state (React hooks, Vue reactive data).",
46
46
  inputSchema: {
47
47
  type: "object",
48
48
  properties: {
@@ -159,7 +159,7 @@ export const toolDefinitions = [
159
159
  },
160
160
  {
161
161
  name: "executeScript",
162
- description: "Execute JavaScript. Use only when specialized tools insufficient. Prefer analyzePage or findElementsByText.",
162
+ description: "⚠️ LAST RESORT tool - use ONLY when ALL specialized tools failed. NEVER use for: clicking (use click), typing (use type), reading page (use analyzePage), finding elements (use findElementsByText). May break React/Vue/Angular synthetic events. ALWAYS try specialized tools first.",
163
163
  inputSchema: {
164
164
  type: "object",
165
165
  properties: {
@@ -231,6 +231,48 @@ export const toolDefinitions = [
231
231
  required: ["selector"],
232
232
  },
233
233
  },
234
+ {
235
+ name: "selectOption",
236
+ description: "Select option in dropdown. Works with HTML select elements. Specify value, text, or index to choose option.",
237
+ inputSchema: {
238
+ type: "object",
239
+ properties: {
240
+ selector: { type: "string", description: "CSS selector for select element" },
241
+ value: { type: "string", description: "Option value attribute (priority 1)" },
242
+ text: { type: "string", description: "Option text content (priority 2)" },
243
+ index: { type: "number", description: "Option index, 0-based (priority 3)" },
244
+ },
245
+ required: ["selector"],
246
+ },
247
+ },
248
+ {
249
+ name: "drag",
250
+ description: "Drag element by mouse (click-hold-move-release). Simulates real mouse drag in any direction. Works with interactive maps, Gantt charts, SVG diagrams, canvas, sliders. Does NOT work with standard overflow scrollbars - use scrollTo/scrollHorizontal instead.",
251
+ inputSchema: {
252
+ type: "object",
253
+ properties: {
254
+ selector: { type: "string", description: "CSS selector for element to drag" },
255
+ direction: { type: "string", enum: ["up", "down", "left", "right", "up-left", "up-right", "down-left", "down-right"], description: "Drag direction" },
256
+ distance: { type: "number", description: "Distance in pixels (default: 100)" },
257
+ duration: { type: "number", description: "Drag duration in ms (default: 500)" },
258
+ },
259
+ required: ["selector", "direction"],
260
+ },
261
+ },
262
+ {
263
+ name: "scrollHorizontal",
264
+ description: "Scroll element horizontally. For tables, carousels, and horizontally scrollable containers. Can scroll by pixels or to the end.",
265
+ inputSchema: {
266
+ type: "object",
267
+ properties: {
268
+ selector: { type: "string", description: "CSS selector for element to scroll" },
269
+ direction: { type: "string", enum: ["left", "right"], description: "Scroll direction" },
270
+ amount: { description: "Pixels to scroll or 'full' for end" },
271
+ behavior: { type: "string", enum: ["auto", "smooth"], description: "Scroll behavior (default: auto)" },
272
+ },
273
+ required: ["selector", "direction", "amount"],
274
+ },
275
+ },
234
276
  {
235
277
  name: "setStyles",
236
278
  description: "Apply inline CSS to element. For live editing and prototyping.",
@@ -403,6 +445,21 @@ export const toolDefinitions = [
403
445
  required: ["fileKey"],
404
446
  },
405
447
  },
448
+ {
449
+ name: "convertFigmaToCode",
450
+ description: "Convert Figma design to React/Tailwind code. Fetches node structure and rendered image, returns simplified design data with AI instructions for generating clean, semantic code. Focuses on React components with Tailwind CSS styling.",
451
+ inputSchema: {
452
+ type: "object",
453
+ properties: {
454
+ figmaToken: { type: "string", description: "API token (optional)" },
455
+ fileKey: { type: "string", description: "File key" },
456
+ nodeId: { type: "string", description: "Frame/component ID (formats: '123:456' or '123-456')" },
457
+ framework: { type: "string", enum: ["react", "react-typescript", "html"], description: "Target framework (default: react)" },
458
+ includeComments: { type: "boolean", description: "Include comments (default: true)" },
459
+ },
460
+ required: ["fileKey", "nodeId"],
461
+ },
462
+ },
406
463
  {
407
464
  name: "smartFindElement",
408
465
  description: "Find elements with natural language. Returns ranked candidates. Prefer analyzePage for better performance.",
@@ -429,7 +486,7 @@ export const toolDefinitions = [
429
486
  },
430
487
  {
431
488
  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. Set includeAll:true to get ALL page elements (useful for layout work and styling non-interactive elements).",
489
+ description: "PRIMARY tool for reading page state (forms, inputs, buttons, links, values). Use this INSTEAD of executeScript for reading page content. Use refresh:true after clicks/submissions to see updated state. Efficient: 2-5k tokens vs screenshot 15-25k. includeAll:true gets ALL elements including non-interactive.",
433
490
  inputSchema: {
434
491
  type: "object",
435
492
  properties: {
@@ -450,7 +507,7 @@ export const toolDefinitions = [
450
507
  },
451
508
  {
452
509
  name: "findElementsByText",
453
- description: "Find elements by text. Returns elements with selectors. Optional actions on first match.",
510
+ description: "Find elements by visible text content and get their selectors. Use this INSTEAD of executeScript when you need to find elements. Returns working selectors that can be used with click/type tools. Can optionally perform actions directly.",
454
511
  inputSchema: {
455
512
  type: "object",
456
513
  properties: {
@@ -7,7 +7,7 @@
7
7
  export const toolGroups = {
8
8
  core: ['ping', 'openBrowser', 'executeScript', 'navigateTo'],
9
9
 
10
- interaction: ['click', 'type', 'scrollTo', 'waitForElement', 'hover'],
10
+ interaction: ['click', 'type', 'scrollTo', 'waitForElement', 'hover', 'selectOption', 'drag', 'scrollHorizontal'],
11
11
 
12
12
  inspection: ['getElement', 'getComputedCss', 'getBoxModel', 'screenshot', 'saveScreenshot'],
13
13
 
@@ -49,7 +49,8 @@ export const toolGroups = {
49
49
  'searchFigmaFrames',
50
50
  'getFigmaComponents',
51
51
  'getFigmaStyles',
52
- 'getFigmaColorPalette'
52
+ 'getFigmaColorPalette',
53
+ 'convertFigmaToCode'
53
54
  ]
54
55
  };
55
56
 
@@ -37,6 +37,28 @@ export const HoverSchema = z.object({
37
37
  selector: z.string().describe("CSS selector for element to hover"),
38
38
  });
39
39
 
40
+ export const SelectOptionSchema = z.object({
41
+ selector: z.string().describe("CSS selector for select element"),
42
+ value: z.string().optional().describe("Value of option to select (option's value attribute)"),
43
+ text: z.string().optional().describe("Text content of option to select"),
44
+ index: z.number().min(0).optional().describe("Index of option to select (0-based)"),
45
+ });
46
+
47
+ export const DragSchema = z.object({
48
+ selector: z.string().describe("CSS selector for element to drag"),
49
+ direction: z.enum(['up', 'down', 'left', 'right', 'up-left', 'up-right', 'down-left', 'down-right'])
50
+ .describe("Direction to drag: vertical (up, down), horizontal (left, right), or diagonal (up-left, up-right, down-left, down-right)"),
51
+ distance: z.number().min(1).optional().describe("Distance to drag in pixels (default: 100)"),
52
+ duration: z.number().min(100).optional().describe("Duration of drag operation in milliseconds (default: 500)"),
53
+ });
54
+
55
+ export const ScrollHorizontalSchema = z.object({
56
+ selector: z.string().describe("CSS selector for element to scroll"),
57
+ direction: z.enum(['left', 'right']).describe("Direction to scroll horizontally"),
58
+ amount: z.union([z.number().min(1), z.literal('full')]).describe("Amount to scroll in pixels, or 'full' to scroll to the end"),
59
+ behavior: z.enum(['auto', 'smooth']).optional().describe("Scroll behavior (default: auto)"),
60
+ });
61
+
40
62
  // CSS tools
41
63
  export const GetComputedCssSchema = z.object({
42
64
  selector: z.string().optional().describe("CSS selector (optional, defaults to body)"),
@@ -200,6 +222,14 @@ export const GetFigmaColorPaletteSchema = z.object({
200
222
  fileKey: z.string().describe("Figma file key or full Figma URL")
201
223
  });
202
224
 
225
+ export const ConvertFigmaToCodeSchema = z.object({
226
+ figmaToken: z.string().optional().describe("Figma API token (optional if FIGMA_TOKEN env var is set)"),
227
+ fileKey: z.string().describe("Figma file key (from URL: figma.com/file/FILE_KEY/...)"),
228
+ nodeId: z.string().describe("Figma node ID (frame/component ID, formats: '123:456' or '123-456')"),
229
+ framework: z.enum(['react', 'react-typescript', 'html']).optional().describe("Target framework (default: react)"),
230
+ includeComments: z.boolean().optional().describe("Include descriptive comments in generated code (default: true)")
231
+ });
232
+
203
233
  // Page analysis tools
204
234
  export const SmartFindElementSchema = z.object({
205
235
  description: z.string().describe("Natural language description of element to find (e.g., 'login button', 'email field')"),