devlens-mcp 0.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.
Files changed (175) hide show
  1. package/.claude/settings.json +12 -0
  2. package/.claude/settings.local.json +17 -0
  3. package/INSTALLATION_GUIDE.md +354 -0
  4. package/QUICK_START.md +153 -0
  5. package/README.md +354 -0
  6. package/bin/cli.ts +22 -0
  7. package/bin/register.ts +96 -0
  8. package/dist/bin/cli.d.ts +3 -0
  9. package/dist/bin/cli.d.ts.map +1 -0
  10. package/dist/bin/cli.js +20 -0
  11. package/dist/bin/cli.js.map +1 -0
  12. package/dist/bin/register.d.ts +10 -0
  13. package/dist/bin/register.d.ts.map +1 -0
  14. package/dist/bin/register.js +92 -0
  15. package/dist/bin/register.js.map +1 -0
  16. package/dist/src/config/devlens-config.d.ts +92 -0
  17. package/dist/src/config/devlens-config.d.ts.map +1 -0
  18. package/dist/src/config/devlens-config.js +70 -0
  19. package/dist/src/config/devlens-config.js.map +1 -0
  20. package/dist/src/index.d.ts +35 -0
  21. package/dist/src/index.d.ts.map +1 -0
  22. package/dist/src/index.js +8 -0
  23. package/dist/src/index.js.map +1 -0
  24. package/dist/src/metro/cdp-client.d.ts +48 -0
  25. package/dist/src/metro/cdp-client.d.ts.map +1 -0
  26. package/dist/src/metro/cdp-client.js +127 -0
  27. package/dist/src/metro/cdp-client.js.map +1 -0
  28. package/dist/src/metro/log-collector.d.ts +30 -0
  29. package/dist/src/metro/log-collector.d.ts.map +1 -0
  30. package/dist/src/metro/log-collector.js +114 -0
  31. package/dist/src/metro/log-collector.js.map +1 -0
  32. package/dist/src/metro/metro-bridge.d.ts +56 -0
  33. package/dist/src/metro/metro-bridge.d.ts.map +1 -0
  34. package/dist/src/metro/metro-bridge.js +255 -0
  35. package/dist/src/metro/metro-bridge.js.map +1 -0
  36. package/dist/src/metro/network-inspector.d.ts +34 -0
  37. package/dist/src/metro/network-inspector.d.ts.map +1 -0
  38. package/dist/src/metro/network-inspector.js +100 -0
  39. package/dist/src/metro/network-inspector.js.map +1 -0
  40. package/dist/src/platform/android/adb.d.ts +50 -0
  41. package/dist/src/platform/android/adb.d.ts.map +1 -0
  42. package/dist/src/platform/android/adb.js +137 -0
  43. package/dist/src/platform/android/adb.js.map +1 -0
  44. package/dist/src/platform/android/android-device.d.ts +21 -0
  45. package/dist/src/platform/android/android-device.d.ts.map +1 -0
  46. package/dist/src/platform/android/android-device.js +94 -0
  47. package/dist/src/platform/android/android-device.js.map +1 -0
  48. package/dist/src/platform/android/ui-automator.d.ts +17 -0
  49. package/dist/src/platform/android/ui-automator.d.ts.map +1 -0
  50. package/dist/src/platform/android/ui-automator.js +126 -0
  51. package/dist/src/platform/android/ui-automator.js.map +1 -0
  52. package/dist/src/platform/device-manager.d.ts +28 -0
  53. package/dist/src/platform/device-manager.d.ts.map +1 -0
  54. package/dist/src/platform/device-manager.js +185 -0
  55. package/dist/src/platform/device-manager.js.map +1 -0
  56. package/dist/src/platform/device.d.ts +86 -0
  57. package/dist/src/platform/device.d.ts.map +1 -0
  58. package/dist/src/platform/device.js +7 -0
  59. package/dist/src/platform/device.js.map +1 -0
  60. package/dist/src/platform/ios/accessibility.d.ts +17 -0
  61. package/dist/src/platform/ios/accessibility.d.ts.map +1 -0
  62. package/dist/src/platform/ios/accessibility.js +159 -0
  63. package/dist/src/platform/ios/accessibility.js.map +1 -0
  64. package/dist/src/platform/ios/ios-device.d.ts +22 -0
  65. package/dist/src/platform/ios/ios-device.d.ts.map +1 -0
  66. package/dist/src/platform/ios/ios-device.js +97 -0
  67. package/dist/src/platform/ios/ios-device.js.map +1 -0
  68. package/dist/src/platform/ios/simctl.d.ts +54 -0
  69. package/dist/src/platform/ios/simctl.d.ts.map +1 -0
  70. package/dist/src/platform/ios/simctl.js +192 -0
  71. package/dist/src/platform/ios/simctl.js.map +1 -0
  72. package/dist/src/server.d.ts +3 -0
  73. package/dist/src/server.d.ts.map +1 -0
  74. package/dist/src/server.js +176 -0
  75. package/dist/src/server.js.map +1 -0
  76. package/dist/src/snapshot/formatter.d.ts +18 -0
  77. package/dist/src/snapshot/formatter.d.ts.map +1 -0
  78. package/dist/src/snapshot/formatter.js +86 -0
  79. package/dist/src/snapshot/formatter.js.map +1 -0
  80. package/dist/src/snapshot/ref-registry.d.ts +67 -0
  81. package/dist/src/snapshot/ref-registry.d.ts.map +1 -0
  82. package/dist/src/snapshot/ref-registry.js +169 -0
  83. package/dist/src/snapshot/ref-registry.js.map +1 -0
  84. package/dist/src/snapshot/snapshot-differ.d.ts +57 -0
  85. package/dist/src/snapshot/snapshot-differ.d.ts.map +1 -0
  86. package/dist/src/snapshot/snapshot-differ.js +153 -0
  87. package/dist/src/snapshot/snapshot-differ.js.map +1 -0
  88. package/dist/src/tools/app-tools.d.ts +71 -0
  89. package/dist/src/tools/app-tools.d.ts.map +1 -0
  90. package/dist/src/tools/app-tools.js +97 -0
  91. package/dist/src/tools/app-tools.js.map +1 -0
  92. package/dist/src/tools/device-tools.d.ts +53 -0
  93. package/dist/src/tools/device-tools.d.ts.map +1 -0
  94. package/dist/src/tools/device-tools.js +86 -0
  95. package/dist/src/tools/device-tools.js.map +1 -0
  96. package/dist/src/tools/ds-tools.d.ts +65 -0
  97. package/dist/src/tools/ds-tools.d.ts.map +1 -0
  98. package/dist/src/tools/ds-tools.js +314 -0
  99. package/dist/src/tools/ds-tools.js.map +1 -0
  100. package/dist/src/tools/interaction-tools.d.ts +248 -0
  101. package/dist/src/tools/interaction-tools.d.ts.map +1 -0
  102. package/dist/src/tools/interaction-tools.js +391 -0
  103. package/dist/src/tools/interaction-tools.js.map +1 -0
  104. package/dist/src/tools/metro-tools.d.ts +115 -0
  105. package/dist/src/tools/metro-tools.d.ts.map +1 -0
  106. package/dist/src/tools/metro-tools.js +270 -0
  107. package/dist/src/tools/metro-tools.js.map +1 -0
  108. package/dist/src/tools/navigation-tools.d.ts +36 -0
  109. package/dist/src/tools/navigation-tools.d.ts.map +1 -0
  110. package/dist/src/tools/navigation-tools.js +60 -0
  111. package/dist/src/tools/navigation-tools.js.map +1 -0
  112. package/dist/src/tools/screenshot-tools.d.ts +298 -0
  113. package/dist/src/tools/screenshot-tools.d.ts.map +1 -0
  114. package/dist/src/tools/screenshot-tools.js +565 -0
  115. package/dist/src/tools/screenshot-tools.js.map +1 -0
  116. package/dist/src/tools/snapshot-tools.d.ts +161 -0
  117. package/dist/src/tools/snapshot-tools.d.ts.map +1 -0
  118. package/dist/src/tools/snapshot-tools.js +479 -0
  119. package/dist/src/tools/snapshot-tools.js.map +1 -0
  120. package/dist/src/utils/image-preprocess.d.ts +49 -0
  121. package/dist/src/utils/image-preprocess.d.ts.map +1 -0
  122. package/dist/src/utils/image-preprocess.js +322 -0
  123. package/dist/src/utils/image-preprocess.js.map +1 -0
  124. package/dist/src/utils/retry.d.ts +21 -0
  125. package/dist/src/utils/retry.d.ts.map +1 -0
  126. package/dist/src/utils/retry.js +33 -0
  127. package/dist/src/utils/retry.js.map +1 -0
  128. package/dist/src/visual/comparator.d.ts +51 -0
  129. package/dist/src/visual/comparator.d.ts.map +1 -0
  130. package/dist/src/visual/comparator.js +119 -0
  131. package/dist/src/visual/comparator.js.map +1 -0
  132. package/dist/src/visual/layout-analyzer.d.ts +64 -0
  133. package/dist/src/visual/layout-analyzer.d.ts.map +1 -0
  134. package/dist/src/visual/layout-analyzer.js +198 -0
  135. package/dist/src/visual/layout-analyzer.js.map +1 -0
  136. package/dist/src/visual/screenshot.d.ts +17 -0
  137. package/dist/src/visual/screenshot.d.ts.map +1 -0
  138. package/dist/src/visual/screenshot.js +39 -0
  139. package/dist/src/visual/screenshot.js.map +1 -0
  140. package/docs/figma-workflow.md +289 -0
  141. package/docs/setup-guide.md +360 -0
  142. package/docs/tool-reference.md +622 -0
  143. package/package.json +57 -0
  144. package/src/config/devlens-config.ts +76 -0
  145. package/src/index.ts +5 -0
  146. package/src/metro/cdp-client.ts +160 -0
  147. package/src/metro/log-collector.ts +137 -0
  148. package/src/metro/metro-bridge.ts +307 -0
  149. package/src/metro/network-inspector.ts +134 -0
  150. package/src/platform/android/adb.ts +200 -0
  151. package/src/platform/android/android-device.ts +116 -0
  152. package/src/platform/android/ui-automator.ts +141 -0
  153. package/src/platform/device-manager.ts +229 -0
  154. package/src/platform/device.ts +110 -0
  155. package/src/platform/ios/accessibility.ts +189 -0
  156. package/src/platform/ios/ios-device.ts +116 -0
  157. package/src/platform/ios/simctl.ts +244 -0
  158. package/src/server.ts +228 -0
  159. package/src/snapshot/formatter.ts +102 -0
  160. package/src/snapshot/ref-registry.ts +230 -0
  161. package/src/snapshot/snapshot-differ.ts +220 -0
  162. package/src/tools/app-tools.ts +111 -0
  163. package/src/tools/device-tools.ts +96 -0
  164. package/src/tools/ds-tools.ts +395 -0
  165. package/src/tools/interaction-tools.ts +467 -0
  166. package/src/tools/metro-tools.ts +320 -0
  167. package/src/tools/navigation-tools.ts +71 -0
  168. package/src/tools/screenshot-tools.ts +698 -0
  169. package/src/tools/snapshot-tools.ts +585 -0
  170. package/src/utils/image-preprocess.ts +430 -0
  171. package/src/utils/retry.ts +51 -0
  172. package/src/visual/comparator.ts +191 -0
  173. package/src/visual/layout-analyzer.ts +283 -0
  174. package/src/visual/screenshot.ts +49 -0
  175. package/tsconfig.json +20 -0
@@ -0,0 +1,360 @@
1
+ # DevLens Setup Guide
2
+
3
+ Get DevLens running in under 5 minutes. This guide covers prerequisites, installation, configuration, and verification.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ ### For Android Development
10
+ 1. **Android Studio** installed with SDK
11
+ 2. **Android Emulator** running (start one from Android Studio > Device Manager)
12
+ 3. **ADB** accessible in PATH (comes with Android SDK)
13
+
14
+ Verify:
15
+ ```bash
16
+ adb devices
17
+ # Should show your running emulator, e.g.:
18
+ # emulator-5554 device
19
+ ```
20
+
21
+ ### For iOS Development (macOS only)
22
+ 1. **Xcode** installed with Command Line Tools
23
+ 2. **iOS Simulator** booted (open from Xcode > Window > Devices & Simulators)
24
+
25
+ Verify:
26
+ ```bash
27
+ xcrun simctl list devices | grep Booted
28
+ # Should show your booted simulator, e.g.:
29
+ # iPhone 16 (XXXX-XXXX) (Booted)
30
+ ```
31
+
32
+ ### For React Native Metro Integration
33
+ 1. **Metro bundler** running:
34
+ ```bash
35
+ cd your-rn-project
36
+ npx react-native start
37
+ # or
38
+ npx expo start
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Installation
44
+
45
+ ### Step 1 — Clone and build
46
+
47
+ ```bash
48
+ git clone https://JioOmni@dev.azure.com/JioOmni/OmniAI/_git/mcp-devlens
49
+ cd mcp-devlens
50
+ npm install
51
+ npm run build
52
+ ```
53
+
54
+ This produces `dist/bin/cli.js`. Note the **absolute path** to this file — you'll need it below.
55
+
56
+ ### Step 2 — Register with your AI client
57
+
58
+ #### Cursor IDE
59
+ Edit `~/.cursor/mcp.json`:
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "devlens": {
64
+ "command": "node",
65
+ "args": ["/absolute/path/to/mcp-devlens/dist/bin/cli.js"],
66
+ "env": {
67
+ "METRO_PORT": "8081",
68
+ "FIGMA_TOKEN": "figd_xxxxx",
69
+ "DEVLENS_CONFIG": "/path/to/your-app/devlens.config.json"
70
+ }
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ Restart Cursor after saving. DevLens tools will appear in the MCP tools panel.
77
+
78
+ #### Claude Code
79
+ ```bash
80
+ claude mcp add devlens -- node /absolute/path/to/mcp-devlens/dist/bin/cli.js
81
+ ```
82
+
83
+ Or run the auto-registration helper from the cloned repo:
84
+ ```bash
85
+ npm run register
86
+ ```
87
+
88
+ This runs `claude mcp add devlens -- node <absolute-path>/dist/bin/cli.js` for you. If DevLens is already registered, it will detect it and skip.
89
+
90
+ #### Claude Desktop
91
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
92
+ ```json
93
+ {
94
+ "mcpServers": {
95
+ "devlens": {
96
+ "command": "node",
97
+ "args": ["/absolute/path/to/mcp-devlens/dist/bin/cli.js"],
98
+ "env": {
99
+ "METRO_PORT": "8081",
100
+ "FIGMA_TOKEN": "figd_xxxxx",
101
+ "DEVLENS_CONFIG": "/path/to/your-app/devlens.config.json"
102
+ }
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ > **Tip:** The `postbuild` script automatically prints the correct `args` path after every build, so you always know the right value to paste.
109
+
110
+ ---
111
+
112
+ ## Configuration
113
+
114
+ ### Environment Variables
115
+
116
+ Set these in the `env` section of your MCP config, or export them in your shell:
117
+
118
+ | Variable | Default | Description |
119
+ |----------|---------|-------------|
120
+ | `FIGMA_TOKEN` | — | Figma personal access token. Required for `devlens_compare_with_figma`. Generate at [figma.com/developers](https://www.figma.com/developers/api#access-tokens). Required scope: **File content: Read**. |
121
+ | `DEVLENS_CONFIG` | — | Absolute path to your `devlens.config.json`. Enables the `devlens_ds_context` tool. |
122
+ | `METRO_PORT` | `8081` | Port where Metro bundler is running |
123
+ | `ANDROID_HOME` | auto-detect | Path to Android SDK (e.g., `/Users/you/Library/Android/sdk`) |
124
+ | `ANDROID_SDK_ROOT` | auto-detect | Alternative to `ANDROID_HOME` |
125
+ | `DEVICE_ID` | first available | Target a specific device by ID |
126
+
127
+ ### Multiple Devices
128
+
129
+ If you have multiple emulators/simulators running, DevLens auto-selects the first one. To target a specific device:
130
+
131
+ 1. Run `devlens_list_devices` to see all available devices
132
+ 2. Pass `deviceId` to any tool: `devlens_device_info(deviceId: "emulator-5554")`
133
+
134
+ Or set `DEVICE_ID=emulator-5554` in your environment.
135
+
136
+ ---
137
+
138
+ ## Design System Configuration
139
+
140
+ DevLens can read your design tokens and component interfaces to give the AI accurate context when writing or fixing UI code. This is configured via a `devlens.config.json` file in your app root.
141
+
142
+ ### 1. Create `devlens.config.json` in your app root
143
+
144
+ ```json
145
+ {
146
+ "designSystem": {
147
+ "name": "jds3",
148
+ "projectRoot": "/absolute/path/to/your-app",
149
+ "tokensFile": "src/constants/figmaTokens.ts",
150
+ "componentsDir": "src/jds-components",
151
+ "componentsGlob": "src/**/*.tsx"
152
+ }
153
+ }
154
+ ```
155
+
156
+ | Field | Required | Description |
157
+ |-------|----------|-------------|
158
+ | `name` | Yes | Design system identifier (e.g. `"jds3"`, `"my-ds"`) |
159
+ | `projectRoot` | Yes | Absolute path to your app root |
160
+ | `tokensFile` | Yes | Path to your token constants file, relative to `projectRoot` |
161
+ | `componentsDir` | No | Path to generated component interface directory, relative to `projectRoot` |
162
+ | `componentsGlob` | No | Glob for component source files (default: `"src/**/*.tsx"`) |
163
+
164
+ ### 2. Point DevLens to the config via the MCP env block
165
+
166
+ Add `DEVLENS_CONFIG` to your `~/.cursor/mcp.json` (or equivalent):
167
+
168
+ ```json
169
+ {
170
+ "mcpServers": {
171
+ "devlens": {
172
+ "command": "node",
173
+ "args": ["/path/to/devlens/dist/bin/cli.js"],
174
+ "env": {
175
+ "METRO_PORT": "8081",
176
+ "FIGMA_TOKEN": "figd_xxxxx",
177
+ "DEVLENS_CONFIG": "/absolute/path/to/your-app/devlens.config.json"
178
+ }
179
+ }
180
+ }
181
+ }
182
+ ```
183
+
184
+ The `devlens.config.json` file lives in your consumer app repository so it stays version-controlled alongside the app it describes.
185
+
186
+ ### 3. Verify with `devlens_ds_context`
187
+
188
+ After restarting your AI client, ask:
189
+
190
+ > *"Load the design system context"*
191
+
192
+ `devlens_ds_context` will return:
193
+ - All token names and values from your tokens file (colors, spacing, typography, etc.)
194
+ - Component prop interfaces from `componentsDir`
195
+ - Real usage patterns scanned from your `.tsx` files
196
+
197
+ ---
198
+
199
+ ## Figma Token Setup
200
+
201
+ `devlens_compare_with_figma` requires a Figma personal access token (PAT).
202
+
203
+ ### Generate a PAT
204
+
205
+ 1. Go to [figma.com](https://www.figma.com) → your profile icon → **Settings**
206
+ 2. Scroll to **Personal access tokens** → **Generate new token**
207
+ 3. Give it a name (e.g. `devlens`)
208
+ 4. Set scope: **File content → Read** (this is the only scope needed)
209
+ 5. Copy the token — it starts with `figd_`
210
+
211
+ ### Verify the token works
212
+
213
+ ```bash
214
+ curl -H "X-Figma-Token: figd_yourtoken" "https://api.figma.com/v1/me"
215
+ # Expected: {"id":"...","email":"you@example.com","handle":"..."}
216
+ ```
217
+
218
+ ### Add to MCP config
219
+
220
+ ```json
221
+ "env": {
222
+ "FIGMA_TOKEN": "figd_yourtoken"
223
+ }
224
+ ```
225
+
226
+ > **Security note:** Never paste your PAT in a chat or commit it to source control. Use environment variables or a secrets manager.
227
+
228
+ ---
229
+
230
+ ## Verifying Setup
231
+
232
+ After configuration, start a conversation with your AI assistant and try these commands in order:
233
+
234
+ ### 1. Check Metro Health
235
+
236
+ > **Say:** *"Check if Metro is running"*
237
+ >
238
+ > **Tool called:** `devlens_metro_status`
239
+ >
240
+ > **Expected:** Running: `true`, Port: `8081`
241
+
242
+ ### 2. List Devices
243
+
244
+ > **Say:** *"List my devices"*
245
+ >
246
+ > **Tool called:** `devlens_list_devices`
247
+ >
248
+ > **Expected:** Your running emulators/simulators listed with IDs
249
+
250
+ ### 3. Take a Screenshot
251
+
252
+ > **Say:** *"Take a screenshot of the device"*
253
+ >
254
+ > **Tool called:** `devlens_screenshot`
255
+ >
256
+ > **Expected:** Device screenshot returned as an inline image
257
+
258
+ ### 4. Take a Snapshot
259
+
260
+ > **Say:** *"Take a snapshot of the screen with validation"*
261
+ >
262
+ > **Tool called:** `devlens_snapshot(validate: true)`
263
+ >
264
+ > **Expected:** Accessibility tree with `ref=eN` IDs + validation report
265
+
266
+ ### 5. Test Metro Logs
267
+
268
+ > **Say:** *"Show me the Metro logs"*
269
+ >
270
+ > **Tool called:** `devlens_metro_logs`
271
+ >
272
+ > **Expected:** Console output from your React Native app
273
+
274
+ ### 6. Compare with Figma (optional — requires FIGMA_TOKEN)
275
+
276
+ > **Say:** *"Compare the current screen with this Figma frame: [your Figma URL]"*
277
+ >
278
+ > **Tool called:** `devlens_compare_with_figma`
279
+ >
280
+ > **Expected:** Three images (device, Figma reference, diff) + layout region report
281
+
282
+ ### 7. Design System Context (optional — requires DEVLENS_CONFIG)
283
+
284
+ > **Say:** *"Load the design system context"*
285
+ >
286
+ > **Tool called:** `devlens_ds_context`
287
+ >
288
+ > **Expected:** Token list, component interfaces, and usage patterns
289
+
290
+ If steps 1–5 succeed, DevLens is fully operational. Steps 6–7 require the optional env vars.
291
+
292
+ ---
293
+
294
+ ## Troubleshooting
295
+
296
+ ### "No running simulators or emulators found"
297
+ - Start an Android emulator from Android Studio, or boot an iOS Simulator from Xcode
298
+ - Verify with `adb devices` (Android) or `xcrun simctl list devices | grep Booted` (iOS)
299
+ - If the device was recently started, DevLens may have a stale cache — the retry system will auto-reconnect
300
+
301
+ ### "Could not connect to Metro bundler"
302
+ - Ensure Metro is running: `npx react-native start` or `npx expo start`
303
+ - Check the port: default is 8081, set `METRO_PORT` if different
304
+ - Metro must be running on the same machine as DevLens
305
+ - Use `devlens_metro_status` to diagnose — it gives actionable error messages
306
+
307
+ ### "ADB command not found"
308
+ - Set `ANDROID_HOME` to your Android SDK path
309
+ - Or add `$ANDROID_HOME/platform-tools` to your PATH
310
+
311
+ ### iOS "simctl not found"
312
+ - Install Xcode Command Line Tools: `xcode-select --install`
313
+ - Ensure Xcode is installed (not just CLT)
314
+
315
+ ### Screenshots return empty or black
316
+ - The app might not be in the foreground; use `devlens_launch_app` first
317
+ - Wait a moment after navigation for the screen to render
318
+ - Use `devlens_wait_for_screen(stableMs: 2000)` to wait for screen stability
319
+
320
+ ### "Invalid token" when using Figma comparison
321
+ - Make sure you're using a **personal access token** (`figd_...`), not an OAuth token
322
+ - Verify it has the **File content: Read** scope
323
+ - Test with: `curl -H "X-Figma-Token: YOUR_TOKEN" "https://api.figma.com/v1/me"`
324
+
325
+ ### "File not exportable" when using Figma comparison
326
+ - The Figma file has export restrictions enabled
327
+ - Ask the file owner to go to **Share → Anyone with link → Uncheck "Prevent viewers from copying and exporting"**
328
+
329
+ ### Layout report is empty or missing in Figma comparison
330
+ - Run `devlens_snapshot` on the current screen before `devlens_compare_with_figma` — the layout report uses element bounds from the snapshot
331
+ - If refs are stale (screen changed), take a fresh snapshot first
332
+
333
+ ### `devlens_ds_context` returns empty or fails
334
+ - Check that `DEVLENS_CONFIG` points to a valid `devlens.config.json` with an absolute `projectRoot`
335
+ - Verify the `tokensFile` path is correct relative to `projectRoot`
336
+ - The tool logs warnings to stderr — check your MCP server logs
337
+
338
+ ### DevLens tools not available in AI assistant
339
+ - **npx users:** Verify the MCP config JSON is correct and restart your AI assistant
340
+ - **Local dev:** Run `npm run register` to register with Claude Code
341
+ - Check `~/.claude/mcp.json` or your IDE's MCP config for a `devlens` entry
342
+
343
+ ---
344
+
345
+ ## What's Available
346
+
347
+ DevLens provides **34 tools** across 8 categories:
348
+
349
+ | Category | Tools | Count |
350
+ |----------|-------|-------|
351
+ | Device Management | list_devices, device_info, set_orientation | 3 |
352
+ | App Management | launch_app, terminate_app, install_app, list_apps | 4 |
353
+ | Snapshot & Elements | snapshot, find_element, wait_for_element, wait_for_screen, element_info | 5 |
354
+ | Interaction | tap, type, swipe, scroll, long_press, press_button, fill_form, capture_flow | 8 |
355
+ | Screenshots & Visual | screenshot, compare_screenshot, element_screenshot, compare_images, compare_with_figma | 5 |
356
+ | React Native / Metro | metro_status, metro_logs, component_tree, hot_reload, network_requests, dismiss_overlays | 6 |
357
+ | Navigation | open_url, go_back | 2 |
358
+ | Design System | ds_context | 1 |
359
+
360
+ See the [Tool Reference](./tool-reference.md) for detailed documentation of every tool and parameter.