chrometools-mcp 2.3.2 → 2.4.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 CHANGED
@@ -2,6 +2,50 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [2.4.2] - 2026-01-05
6
+
7
+ ### Added
8
+ - **`analyzePage` - `includeAll` parameter** - New optional parameter to get ALL page elements, not just interactive ones
9
+ - Set `includeAll: true` to get complete page structure with selectors for all visible elements
10
+ - Returns new `allElements` array containing divs, spans, headings, and all other visible elements
11
+ - Each element includes: selector, tag, text, classes, id, and attributes (role, aria-label)
12
+ - Useful for layout work and styling - find any element, get its selector, then use `getComputedCss` or `setStyles`
13
+ - Example workflow: `analyzePage({ includeAll: true })` → find element → `getComputedCss({ selector })` or `setStyles({ selector })`
14
+ - Skips hidden elements and non-visual tags (SCRIPT, STYLE, META, etc.)
15
+ - Location: `index.js:1613-1751`, schemas in `tools/tool-schemas.js:215`, `server/tool-schemas.js:221`
16
+
17
+ ### Changed
18
+ - **Tool Groups reorganization** - Moved `executeScript` and `navigateTo` from `advanced` to `core` group
19
+ - These are fundamental navigation and scripting tools that should be available in basic configurations
20
+ - Core group now includes: `ping`, `openBrowser`, `executeScript`, `navigateTo` (4 tools)
21
+ - Advanced group now has: `setStyles`, `setViewport`, `getViewport`, `smartFindElement`, `analyzePage`, `getAllInteractiveElements`, `findElementsByText` (7 tools)
22
+ - Location: `server/tool-groups.js:8,21-29`
23
+
24
+ ## [2.4.0] - 2025-12-29
25
+
26
+ ### Added
27
+ - **Tool Filtering by Groups** - New `ENABLED_TOOLS` environment variable for selective group enabling
28
+ - Configure via `env.ENABLED_TOOLS` in MCP client config (comma-separated list of group names)
29
+ - Available groups: `core`, `interaction`, `inspection`, `debug`, `advanced`, `recorder`, `figma`
30
+ - Group structure optimized:
31
+ - `debug` - NEW group for debugging tools (console logs, network monitoring)
32
+ - `advanced` - Combined with AI tools (now includes smartFindElement, analyzePage, etc.)
33
+ - If not set, all tools are enabled (default behavior)
34
+ - If set, only tools from specified groups are available to AI
35
+ - Primary benefit: **Token optimization** - all 43 tools consume ~28k tokens (~14% of context). Enable only needed groups to reduce token usage and costs
36
+ - Additional use cases: security/compliance restrictions, workflow simplification, improved AI focus
37
+ - Examples:
38
+ - Basic automation: `ENABLED_TOOLS=core,interaction,inspection`
39
+ - Advanced with AI: `ENABLED_TOOLS=core,interaction,advanced`
40
+ - With debugging: `ENABLED_TOOLS=core,interaction,inspection,debug`
41
+ - Figma validation: `ENABLED_TOOLS=core,figma`
42
+ - Location:
43
+ - `server/tool-groups.js` - group definitions (7 groups, 43 tools total)
44
+ - `index.js:36` - import groups module
45
+ - `index.js:77-92` - parsing and filtering logic
46
+ - `index.js:195-203` - apply filter to ListTools handler
47
+ - Documentation: README.md section "Tool Filtering with ENABLED_TOOLS"
48
+
5
49
  ## [2.3.2] - 2025-12-25
6
50
 
7
51
  ### Changed
package/README.md CHANGED
@@ -148,18 +148,27 @@ Get current page state and structure. Returns complete map of forms (with values
148
148
  - **After form submissions** (check results, errors)
149
149
  - **After AJAX updates** (dynamic content loaded)
150
150
  - When debugging (see actual form values, not just visual)
151
+ - **Layout/styling work** - use `includeAll: true` to get ALL page elements with selectors
151
152
  - **Parameters**:
152
153
  - `refresh` (optional): Force refresh cache to get CURRENT state after changes (default: false)
154
+ - `includeAll` (optional): Include ALL page elements, not just interactive ones (default: false). Useful for layout work - find any element, get its selector, then use `getComputedCss` or `setStyles` on it.
153
155
  - **Why better than screenshot**:
154
156
  - Shows actual data (form values, validation errors) not just visual
155
157
  - Uses 2-5k tokens vs screenshot 15-25k tokens
156
158
  - Returns structured data with selectors
157
- - **Returns**: Complete map of forms (with current values), inputs, buttons, links, navigation with selectors
159
+ - **Returns**:
160
+ - By default: Complete map of forms (with current values), inputs, buttons, links, navigation with selectors
161
+ - With `includeAll: true`: Also includes `allElements` array with ALL visible page elements (divs, spans, headings, etc.) - each with selector, tag, text, classes, id
158
162
  - **Example workflow**:
159
163
  1. `openBrowser({ url: "..." })`
160
164
  2. `analyzePage()` ← Initial analysis
161
165
  3. `click({ selector: "submit-btn" })`
162
166
  4. **`analyzePage({ refresh: true })`** ← See what changed after click!
167
+ - **Layout work example**:
168
+ 1. `analyzePage({ includeAll: true })` ← Get all elements
169
+ 2. Find element you want to style (e.g., `div.header`)
170
+ 3. `getComputedCss({ selector: "div.header" })` ← Get current styles
171
+ 4. `setStyles({ selector: "div.header", styles: [...] })` ← Apply new styles
163
172
 
164
173
  #### getAllInteractiveElements
165
174
  Get all clickable/fillable elements with their selectors.
@@ -965,6 +974,106 @@ If you don't need to see the browser window, you can use xvfb (virtual X server)
965
974
 
966
975
  This runs Chrome in GUI mode but on a virtual display (window is not visible).
967
976
 
977
+ ### Tool Filtering with ENABLED_TOOLS
978
+
979
+ By default, all tools are enabled. You can selectively enable only specific tool groups using the `ENABLED_TOOLS` environment variable.
980
+
981
+ **Why filter tools?**
982
+
983
+ Each tool definition is sent to the AI in every request, consuming context tokens. All 43 tools consume ~28k tokens (~14% of context window). By enabling only the groups you need, you can significantly reduce token usage:
984
+
985
+ - **Save tokens:** Fewer tools = less context consumed per request
986
+ - **Reduce costs:** Lower token usage means lower API costs
987
+ - **Improve focus:** AI sees only relevant tools for your workflow
988
+ - **Security/compliance:** Restrict available capabilities when needed
989
+
990
+ **Available Tool Groups:**
991
+
992
+ | Group | Description | Tools (count) |
993
+ |-------|-------------|---------------|
994
+ | `core` | Basic tools | `ping`, `openBrowser` (2) |
995
+ | `interaction` | User interaction | `click`, `type`, `scrollTo`, `waitForElement`, `hover` (5) |
996
+ | `inspection` | Page inspection | `getElement`, `getComputedCss`, `getBoxModel`, `screenshot`, `saveScreenshot` (5) |
997
+ | `debug` | Debugging & network | `getConsoleLogs`, `listNetworkRequests`, `getNetworkRequest`, `filterNetworkRequests` (4) |
998
+ | `advanced` | Advanced automation & AI | `executeScript`, `setStyles`, `setViewport`, `getViewport`, `navigateTo`, `smartFindElement`, `analyzePage`, `getAllInteractiveElements`, `findElementsByText` (9) |
999
+ | `recorder` | Scenario recording | `enableRecorder`, `executeScenario`, `listScenarios`, `searchScenarios`, `getScenarioInfo`, `deleteScenario`, `exportScenarioAsCode`, `appendScenarioToFile`, `generatePageObject` (9) |
1000
+ | `figma` | Figma integration | `getFigmaFrame`, `compareFigmaToElement`, `getFigmaSpecs`, `parseFigmaUrl`, `listFigmaPages`, `searchFigmaFrames`, `getFigmaComponents`, `getFigmaStyles`, `getFigmaColorPalette` (9) |
1001
+
1002
+ **Total:** 43 tools across 7 groups
1003
+
1004
+ **Configuration:**
1005
+
1006
+ **Claude Desktop** (`~/.claude/mcp_config.json`):
1007
+
1008
+ ```json
1009
+ {
1010
+ "mcpServers": {
1011
+ "chrometools": {
1012
+ "command": "npx",
1013
+ "args": ["-y", "chrometools-mcp"],
1014
+ "env": {
1015
+ "ENABLED_TOOLS": "core,interaction,inspection"
1016
+ }
1017
+ }
1018
+ }
1019
+ }
1020
+ ```
1021
+
1022
+ **Claude Code** (`~/.claude.json`):
1023
+
1024
+ ```json
1025
+ {
1026
+ "mcpServers": {
1027
+ "chrometools": {
1028
+ "type": "stdio",
1029
+ "command": "npx",
1030
+ "args": ["-y", "chrometools-mcp"],
1031
+ "env": {
1032
+ "ENABLED_TOOLS": "core,interaction,advanced"
1033
+ }
1034
+ }
1035
+ }
1036
+ }
1037
+ ```
1038
+
1039
+ **Format:**
1040
+ - Comma-separated list of group names (e.g., `"core,interaction,advanced"`)
1041
+ - Spaces are automatically trimmed
1042
+ - If not set or empty, all tools are enabled (default behavior)
1043
+
1044
+ **Example configurations:**
1045
+
1046
+ **Basic automation only:**
1047
+ ```json
1048
+ "ENABLED_TOOLS": "core,interaction,inspection"
1049
+ ```
1050
+
1051
+ **Advanced automation with AI:**
1052
+ ```json
1053
+ "ENABLED_TOOLS": "core,interaction,advanced"
1054
+ ```
1055
+
1056
+ **With debugging tools:**
1057
+ ```json
1058
+ "ENABLED_TOOLS": "core,interaction,inspection,debug"
1059
+ ```
1060
+
1061
+ **Figma design validation:**
1062
+ ```json
1063
+ "ENABLED_TOOLS": "core,figma"
1064
+ ```
1065
+
1066
+ **Full automation with recording:**
1067
+ ```json
1068
+ "ENABLED_TOOLS": "core,interaction,inspection,debug,advanced,recorder"
1069
+ ```
1070
+
1071
+ **All tools (default):**
1072
+ ```json
1073
+ "env": {}
1074
+ ```
1075
+ or omit the `env` field entirely.
1076
+
968
1077
  ### Figma API Token Setup
969
1078
 
970
1079
  To use Figma tools, you need to configure your Figma Personal Access Token.