react-native-ai-devtools 1.4.15 → 1.4.17
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/README.md +69 -1012
- package/build/index.js +27 -45
- package/build/index.js.map +1 -1
- package/build/pro/tap.d.ts.map +1 -1
- package/build/pro/tap.js +15 -2
- package/build/pro/tap.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,12 +13,10 @@ Have an idea or found something that could be better? Head over to [GitHub Discu
|
|
|
13
13
|
### Runtime Interaction
|
|
14
14
|
|
|
15
15
|
- **Console Log Capture** - Capture `console.log`, `warn`, `error`, `info`, `debug` with filtering and search
|
|
16
|
-
- **React Component Inspection** - Inspect component tree, props, state/hooks, and layout styles at runtime
|
|
17
16
|
- **Network Request Tracking** - Monitor HTTP requests/responses with headers, timing, and body content. Install the optional [SDK](https://www.npmjs.com/package/react-native-ai-devtools-sdk) for full capture from app startup including request/response bodies
|
|
18
17
|
- **JavaScript Execution** - Run code directly in your app (REPL-style) and inspect results
|
|
19
18
|
- **Global State Debugging** - Discover and inspect Apollo Client, Redux stores, Expo Router, and custom globals
|
|
20
19
|
- **Bundle Error Detection** - Get Metro bundler errors and compilation issues with file locations
|
|
21
|
-
- **Debug Web Dashboard** - Browser-based UI for real-time log and network monitoring
|
|
22
20
|
|
|
23
21
|
### Device Control
|
|
24
22
|
|
|
@@ -44,56 +42,57 @@ Have an idea or found something that could be better? Head over to [GitHub Discu
|
|
|
44
42
|
- **Efficient Buffering** - Circular buffers: 500 logs, 200 network requests
|
|
45
43
|
- **Platform Support** - Expo SDK 54+ (Bridgeless) and React Native 0.70+ (Hermes)
|
|
46
44
|
|
|
47
|
-
##
|
|
45
|
+
## Platform Setup
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
### Android
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
Android works out of the box — all device control tools use ADB, which ships with Android Studio. Verify it's available:
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
| `debug-logs` | Capture, filter, and analyze console logs to find errors and warnings |
|
|
57
|
-
| `network-inspect` | Monitor and inspect HTTP requests, filter by status/method, and analyze failures |
|
|
58
|
-
| `app-state` | Inspect Redux/Apollo/context state, navigate the app, and execute code in the runtime |
|
|
59
|
-
| `component-inspect` | Inspect React component tree, props, state, and layout |
|
|
60
|
-
| `layout-check` | Verify UI layout against design specs using screenshots and component data |
|
|
61
|
-
| `device-interact` | Automate device interaction: tap, swipe, text input, and element finding |
|
|
62
|
-
| `bundle-check` | Detect and diagnose Metro bundler errors and compilation failures |
|
|
63
|
-
| `native-rebuild` | Rebuild and verify the app after installing native Expo packages |
|
|
51
|
+
```bash
|
|
52
|
+
adb devices
|
|
53
|
+
```
|
|
64
54
|
|
|
65
|
-
|
|
55
|
+
### iOS Simulator — IDB Setup
|
|
66
56
|
|
|
67
|
-
|
|
57
|
+
[IDB (iOS Development Bridge)](https://github.com/facebook/idb) is a tool built by Meta for automating iOS Simulators and devices. It provides programmatic access to gestures, text input, accessibility trees, and more — capabilities that Apple's built-in `simctl` doesn't cover.
|
|
68
58
|
|
|
69
|
-
|
|
59
|
+
Many iOS tools (tap, swipe, text input, accessibility queries) require IDB's `idb-companion` daemon. Without it, the tool can detect UI elements via OCR but **cannot execute taps or gestures** on iOS Simulators.
|
|
60
|
+
|
|
61
|
+
**Install:**
|
|
70
62
|
|
|
71
63
|
```bash
|
|
72
|
-
|
|
73
|
-
mkdir -p .claude/skills
|
|
74
|
-
curl -s https://api.github.com/repos/igorzheludkov/react-native-ai-devtools/contents/skills \
|
|
75
|
-
| grep download_url \
|
|
76
|
-
| cut -d '"' -f 4 \
|
|
77
|
-
| xargs -I {} sh -c 'curl -sL {} -o .claude/skills/$(basename {})'
|
|
64
|
+
brew install idb-companion
|
|
78
65
|
```
|
|
79
66
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Then invoke in Claude Code:
|
|
67
|
+
**Verify:**
|
|
83
68
|
|
|
69
|
+
```bash
|
|
70
|
+
idb_companion --list 1
|
|
84
71
|
```
|
|
85
|
-
/session-setup
|
|
86
|
-
/debug-logs
|
|
87
|
-
/network-inspect
|
|
88
|
-
```
|
|
89
72
|
|
|
90
|
-
|
|
73
|
+
You should see a list of available simulators. If the command is not found, the installation didn't succeed.
|
|
74
|
+
|
|
75
|
+
**What works without IDB:**
|
|
76
|
+
|
|
77
|
+
| Capability | Without IDB | With IDB |
|
|
78
|
+
|------------|-------------|----------|
|
|
79
|
+
| Screenshots | Yes (simctl) | Yes |
|
|
80
|
+
| App install/launch/terminate | Yes (simctl) | Yes |
|
|
81
|
+
| URL opening | Yes (simctl) | Yes |
|
|
82
|
+
| Boot simulator | Yes (simctl) | Yes |
|
|
83
|
+
| **Tap / swipe / gestures** | **No** | Yes |
|
|
84
|
+
| **Text input** | **No** | Yes |
|
|
85
|
+
| **Accessibility tree queries** | **No** | Yes |
|
|
86
|
+
| **Element finding / waiting** | **No** | Yes |
|
|
87
|
+
| **Hardware buttons (Home, Lock)** | **No** | Yes |
|
|
88
|
+
|
|
89
|
+
> **Troubleshooting**: If you see errors like `"IDB is not installed"` or `"Coordinate tap failed: IDB is not installed"` in tap results, install IDB with the command above and retry.
|
|
91
90
|
|
|
92
91
|
## Requirements
|
|
93
92
|
|
|
94
93
|
- Node.js 18+
|
|
95
94
|
- React Native app running with Metro bundler
|
|
96
|
-
- **
|
|
95
|
+
- **iOS UI automation**: [Facebook IDB](https://fbidb.io/) — `brew install idb-companion` (required for tap, swipe, text input, accessibility on iOS Simulator)
|
|
97
96
|
- **Optional for offline OCR fallback**: Python 3.6+ (only needed when cloud OCR is unavailable, see [OCR Setup](#ocr-text-extraction))
|
|
98
97
|
|
|
99
98
|
## Claude Code Setup
|
|
@@ -169,167 +168,22 @@ Requires VS Code 1.102+ with Copilot ([docs](https://code.visualstudio.com/docs/
|
|
|
169
168
|
}
|
|
170
169
|
```
|
|
171
170
|
|
|
172
|
-
##
|
|
173
|
-
|
|
174
|
-
### Usage Guide
|
|
175
|
-
|
|
176
|
-
| Tool | Description |
|
|
177
|
-
| ----------------- | --------------------------------------------------------------------------- |
|
|
178
|
-
| `get_usage_guide` | Get recommended workflows for all tools. Call without params for overview, with a topic (`setup`, `inspect`, `layout`, `interact`, `logs`, `network`, `state`, `bundle`) for the full guide |
|
|
179
|
-
|
|
180
|
-
The server also sends instructions on connection, so MCP clients automatically learn about `get_usage_guide`.
|
|
181
|
-
|
|
182
|
-
### Connection & Logs
|
|
183
|
-
|
|
184
|
-
| Tool | Description |
|
|
185
|
-
| ----------------------- | ------------------------------------------------------------------ |
|
|
186
|
-
| `scan_metro` | Scan for Metro servers and auto-connect. **Call this first** to start debugging |
|
|
187
|
-
| `connect_metro` | Connect to a specific Metro port (use when you know the exact port) |
|
|
188
|
-
| `disconnect_metro` | Disconnect from all Metro servers. Frees the CDP slot for the built-in RN debugger. Reconnect with `scan_metro` |
|
|
189
|
-
| `get_apps` | List connected apps. Run `scan_metro` first if none connected |
|
|
190
|
-
| `get_connection_status` | Get detailed connection health, uptime, and recent disconnects |
|
|
191
|
-
| `ensure_connection` | Verify/establish connection with health checks |
|
|
192
|
-
| `get_logs` | Retrieve console logs (filtering, truncation, summary, TONL format) |
|
|
193
|
-
| `search_logs` | Search logs for specific text (truncation, TONL format) |
|
|
194
|
-
| `clear_logs` | Clear the log buffer |
|
|
195
|
-
|
|
196
|
-
### Network Tracking
|
|
197
|
-
|
|
198
|
-
| Tool | Description |
|
|
199
|
-
| ---------------------- | ---------------------------------------------------------- |
|
|
200
|
-
| `get_network_requests` | Retrieve network requests (filtering, summary, TONL format) |
|
|
201
|
-
| `search_network` | Search requests by URL pattern (TONL format) |
|
|
202
|
-
| `get_request_details` | Get full details of a request (headers, body with truncation) |
|
|
203
|
-
| `get_network_stats` | Get statistics: counts by method, status code, domain |
|
|
204
|
-
| `clear_network` | Clear the network request buffer |
|
|
205
|
-
|
|
206
|
-
### App Inspection & Execution
|
|
207
|
-
|
|
208
|
-
| Tool | Description |
|
|
209
|
-
| -------------------- | ------------------------------------------------------------------- |
|
|
210
|
-
| `execute_in_app` | Execute simple JS expressions using globals discovered via `list_debug_globals` |
|
|
211
|
-
| `list_debug_globals` | Discover available debug objects (Apollo, Redux, Expo Router, etc.) |
|
|
212
|
-
| `inspect_global` | Inspect a global object to see its properties and callable methods |
|
|
213
|
-
| `reload_app` | Reload the app (auto-connects if needed). Use sparingly - Fast Refresh handles most changes |
|
|
214
|
-
| `get_debug_server` | Get the debug HTTP server URL for browser-based viewing |
|
|
215
|
-
| `restart_http_server` | Restart the debug HTTP server |
|
|
216
|
-
|
|
217
|
-
### Bundle Tools
|
|
218
|
-
|
|
219
|
-
| Tool | Description |
|
|
220
|
-
| -------------------- | ------------------------------------------------------------------- |
|
|
221
|
-
| `get_bundle_status` | Get Metro bundler status and build state |
|
|
222
|
-
| `get_bundle_errors` | Get compilation errors with file locations |
|
|
223
|
-
| `clear_bundle_errors` | Clear the bundle error buffer |
|
|
224
|
-
|
|
225
|
-
### React Component Inspection
|
|
226
|
-
|
|
227
|
-
**Recommended Workflow**: Use `get_component_tree(focusedOnly=true, structureOnly=true)` for a token-efficient overview of just the active screen (~1-3KB), then drill down with `inspect_component` or `find_components`.
|
|
228
|
-
|
|
229
|
-
| Tool | Description |
|
|
230
|
-
| -------------------- | ------------------------------------------------------------------- |
|
|
231
|
-
| `get_component_tree` | **Start here** with `focusedOnly=true, structureOnly=true` for active screen overview |
|
|
232
|
-
| `inspect_component` | **Drill-down tool**: Inspect specific component's props, state/hooks, children |
|
|
233
|
-
| `find_components` | **Targeted search**: Find components by pattern with optional layout info |
|
|
234
|
-
| `get_screen_layout` | Full layout data - use sparingly, can be large for complex screens |
|
|
235
|
-
|
|
236
|
-
### Element Inspector (Coordinate-Based)
|
|
237
|
-
|
|
238
|
-
Inspect React components at specific screen coordinates - like React Native's built-in Element Inspector, but programmatically.
|
|
239
|
-
|
|
240
|
-
| Tool | Description |
|
|
241
|
-
| -------------------------- | ------------------------------------------------------------------------------ |
|
|
242
|
-
| `get_inspector_selection` | **Main tool**: Get React component at coordinates. Auto-enables inspector and taps if x/y provided |
|
|
243
|
-
| `toggle_element_inspector` | Manually toggle the Element Inspector overlay on/off |
|
|
244
|
-
| `inspect_at_point` | Inspect React component at (x,y) coordinates |
|
|
245
|
-
|
|
246
|
-
**Quick Inspection (Recommended)**:
|
|
247
|
-
```
|
|
248
|
-
# Single call - auto-enables inspector, taps, returns component info
|
|
249
|
-
get_inspector_selection(x=210, y=400)
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
Returns:
|
|
253
|
-
```
|
|
254
|
-
Element: FastImageView
|
|
255
|
-
Path: App > RootNavigation > ... > PlayerModal > FastImage > FastImageView
|
|
256
|
-
Frame: (62.3, 130.0) 295.67x295.67
|
|
257
|
-
Style: { borderRadius: 15, overflow: "hidden" }
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
**Manual Flow** (for more control):
|
|
261
|
-
```
|
|
262
|
-
# 1. Enable the inspector overlay
|
|
263
|
-
toggle_element_inspector()
|
|
264
|
-
|
|
265
|
-
# 2. Tap to select element
|
|
266
|
-
tap with x=630 y=1200 # pixel coordinates from screenshot
|
|
267
|
-
|
|
268
|
-
# 3. Read the selection
|
|
269
|
-
get_inspector_selection()
|
|
270
|
-
|
|
271
|
-
# 4. Disable overlay when done
|
|
272
|
-
toggle_element_inspector()
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
**Token Efficiency**: Returns ~0.2-0.5KB vs 15-25KB for full component tree. Works on all React Native versions including Fabric/New Architecture.
|
|
171
|
+
## Claude Code Skills
|
|
276
172
|
|
|
277
|
-
|
|
173
|
+
Pre-built skills for common debugging workflows — session setup, log inspection, network debugging, and more. See the [skills guide](docs/skills.md) for the full list and installation instructions.
|
|
278
174
|
|
|
279
|
-
|
|
280
|
-
| ---------------- | ------------------------------------------------------------------------ |
|
|
281
|
-
| `tap` | **Unified tap** — auto-detects platform, tries fiber tree → accessibility → OCR → coordinates. Accepts text, testID, component name, or pixel coordinates from screenshots. Returns a post-tap screenshot by default and verifies visual change via before/after diff. Use `native=true` for coordinate taps without React Native connection (system dialogs, non-RN apps) |
|
|
282
|
-
| `ocr_screenshot` | Extract all visible text with tap-ready coordinates (works on iOS/Android) |
|
|
175
|
+
## Available Tools
|
|
283
176
|
|
|
284
|
-
|
|
285
|
-
```
|
|
286
|
-
tap with text="Submit" # Finds and taps by visible text
|
|
287
|
-
tap with testID="login-btn" # Finds by testID prop
|
|
288
|
-
tap with component="HamburgerIcon" # Finds by React component name
|
|
289
|
-
tap with x=300 y=600 # Taps at pixel coordinates (auto-converts)
|
|
290
|
-
tap with text="Menu" strategy="ocr" # Forces OCR strategy only
|
|
291
|
-
tap with x=300 y=600 native=true # Taps directly via ADB/simctl (no RN connection needed)
|
|
292
|
-
```
|
|
177
|
+
See the [full tool reference](docs/tools.md) for all tools with descriptions. Key tools:
|
|
293
178
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
|
297
|
-
|
|
|
298
|
-
| `
|
|
299
|
-
| `
|
|
300
|
-
| `
|
|
301
|
-
| `
|
|
302
|
-
| `android_list_packages` | List installed packages (with optional filter) |
|
|
303
|
-
| `android_long_press` | Long press at specific coordinates |
|
|
304
|
-
| `android_swipe` | Swipe from one point to another |
|
|
305
|
-
| `android_input_text` | Type text at current focus point |
|
|
306
|
-
| `android_key_event` | Send key events (HOME, BACK, ENTER, etc.) |
|
|
307
|
-
| `android_get_screen_size` | Get device screen resolution |
|
|
308
|
-
| `android_describe_all` | Get full UI accessibility tree via uiautomator |
|
|
309
|
-
| `android_describe_point` | Get UI element info at specific coordinates |
|
|
310
|
-
| `android_find_element` | Find element by text/contentDesc/resourceId (no screenshot) |
|
|
311
|
-
| `android_wait_for_element` | Wait for element to appear (useful for screen transitions) |
|
|
312
|
-
|
|
313
|
-
### iOS (Simulator)
|
|
314
|
-
|
|
315
|
-
| Tool | Description |
|
|
316
|
-
| ----------------------- | --------------------------------------------------------------- |
|
|
317
|
-
| `list_ios_simulators` | List available iOS simulators |
|
|
318
|
-
| `ios_screenshot` | Take a screenshot from an iOS simulator |
|
|
319
|
-
| `ios_install_app` | Install an app bundle (.app) on a simulator |
|
|
320
|
-
| `ios_launch_app` | Launch an app by bundle ID |
|
|
321
|
-
| `ios_open_url` | Open a URL (deep links or web URLs) |
|
|
322
|
-
| `ios_terminate_app` | Terminate a running app |
|
|
323
|
-
| `ios_boot_simulator` | Boot a simulator by UDID |
|
|
324
|
-
| `ios_swipe` | Swipe gesture (requires IDB) |
|
|
325
|
-
| `ios_input_text` | Type text into active field (requires IDB) |
|
|
326
|
-
| `ios_button` | Press hardware button: HOME, LOCK, SIRI (requires IDB) |
|
|
327
|
-
| `ios_key_event` | Send key event by keycode (requires IDB) |
|
|
328
|
-
| `ios_key_sequence` | Send sequence of key events (requires IDB) |
|
|
329
|
-
| `ios_describe_all` | Get full accessibility tree (requires IDB) |
|
|
330
|
-
| `ios_describe_point` | Get element at point (requires IDB) |
|
|
331
|
-
| `ios_find_element` | Find element by label/value (requires IDB, no screenshot) |
|
|
332
|
-
| `ios_wait_for_element` | Wait for element to appear (requires IDB) |
|
|
179
|
+
| Tool | Description |
|
|
180
|
+
| ---- | ----------- |
|
|
181
|
+
| `scan_metro` | **Start here** — scan for Metro servers and auto-connect |
|
|
182
|
+
| `get_logs` / `search_logs` | Capture and search console logs with filtering and summaries |
|
|
183
|
+
| `get_network_requests` | Monitor HTTP requests with method/status filtering |
|
|
184
|
+
| `tap` | **Unified tap** — auto-detects platform, tries fiber → accessibility → OCR → coordinates |
|
|
185
|
+
| `execute_in_app` | Run JS expressions in the app runtime (REPL-style) |
|
|
186
|
+
| `ios_screenshot` / `android_screenshot` | Take device screenshots |
|
|
333
187
|
|
|
334
188
|
## Usage
|
|
335
189
|
|
|
@@ -352,826 +206,27 @@ tap with x=300 y=600 native=true # Taps directly via ADB/simctl (no RN
|
|
|
352
206
|
Use get_logs to see recent console output
|
|
353
207
|
```
|
|
354
208
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
The `get_logs` tool has multiple parameters for controlling output size and format. Here's the complete reference:
|
|
358
|
-
|
|
359
|
-
| Parameter | Type | Default | Description |
|
|
360
|
-
|-----------|------|---------|-------------|
|
|
361
|
-
| `maxLogs` | number | 50 | Maximum number of logs to return |
|
|
362
|
-
| `level` | string | "all" | Filter by level: `all`, `log`, `warn`, `error`, `info`, `debug` |
|
|
363
|
-
| `startFromText` | string | - | Start from the last log containing this text |
|
|
364
|
-
| `maxMessageLength` | number | 500 | Max chars per message (0 = unlimited) |
|
|
365
|
-
| `verbose` | boolean | false | Disable all truncation, return full messages |
|
|
366
|
-
| `format` | string | "text" | Output format: `text` or `tonl` (30-50% smaller) |
|
|
367
|
-
| `summary` | boolean | false | Return counts + last 5 messages only |
|
|
368
|
-
|
|
369
|
-
#### Recommended Usage Patterns
|
|
370
|
-
|
|
371
|
-
```
|
|
372
|
-
# Quick overview (always start here)
|
|
373
|
-
get_logs with summary=true
|
|
374
|
-
|
|
375
|
-
# Recent errors only
|
|
376
|
-
get_logs with level="error" maxLogs=20
|
|
377
|
-
|
|
378
|
-
# Logs since last app reload
|
|
379
|
-
get_logs with startFromText="Running app" maxLogs=100
|
|
380
|
-
|
|
381
|
-
# Full messages for debugging specific issues
|
|
382
|
-
get_logs with maxLogs=10 verbose=true
|
|
383
|
-
|
|
384
|
-
# Token-efficient format for large outputs
|
|
385
|
-
get_logs with format="tonl" maxLogs=100
|
|
386
|
-
|
|
387
|
-
# Compact overview with shorter messages
|
|
388
|
-
get_logs with maxMessageLength=200 maxLogs=50
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
### Filtering Logs
|
|
392
|
-
|
|
393
|
-
```
|
|
394
|
-
get_logs with maxLogs=20 and level="error"
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
Available levels: `all`, `log`, `warn`, `error`, `info`, `debug`
|
|
398
|
-
|
|
399
|
-
### Start from Specific Line
|
|
400
|
-
|
|
401
|
-
```
|
|
402
|
-
get_logs with startFromText="iOS Bundled" and maxLogs=100
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
This finds the **last** (most recent) line containing the text and returns logs from that point forward. Useful for getting logs since the last app reload.
|
|
406
|
-
|
|
407
|
-
### Search Logs
|
|
408
|
-
|
|
409
|
-
```
|
|
410
|
-
search_logs with text="error" and maxResults=20
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
Case-insensitive search across all log messages.
|
|
414
|
-
|
|
415
|
-
### Token-Optimized Output
|
|
416
|
-
|
|
417
|
-
The tools include several options to reduce token usage when working with AI assistants.
|
|
418
|
-
|
|
419
|
-
#### Summary Mode (Recommended First Step)
|
|
420
|
-
|
|
421
|
-
**Always start with `summary=true`** - it gives you the full picture in ~10-20 tokens instead of potentially thousands:
|
|
422
|
-
|
|
423
|
-
```
|
|
424
|
-
get_logs with summary=true
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
Returns:
|
|
428
|
-
- **Total count** - How many logs are in the buffer
|
|
429
|
-
- **Breakdown by level** - See if there are errors/warnings at a glance
|
|
430
|
-
- **Last 5 messages** - Most recent activity (truncated to 100 chars each)
|
|
431
|
-
|
|
432
|
-
Example output:
|
|
433
|
-
|
|
434
|
-
```
|
|
435
|
-
Total: 847 logs
|
|
436
|
-
|
|
437
|
-
By Level:
|
|
438
|
-
LOG: 612
|
|
439
|
-
WARN: 180
|
|
440
|
-
ERROR: 55
|
|
441
|
-
|
|
442
|
-
Last 5 messages:
|
|
443
|
-
14:32:45 [LOG] User clicked button...
|
|
444
|
-
14:32:46 [WARN] Slow query detected...
|
|
445
|
-
14:32:47 [ERROR] Network request failed...
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
#### Why Summary First?
|
|
449
|
-
|
|
450
|
-
| Approach | Tokens | Use Case |
|
|
451
|
-
|----------|--------|----------|
|
|
452
|
-
| `summary=true` | ~20-50 | Quick health check, see if errors exist |
|
|
453
|
-
| `level="error"` | ~100-500 | Investigate specific errors |
|
|
454
|
-
| `maxLogs=50` (default) | ~500-2000 | General debugging |
|
|
455
|
-
| `verbose=true` | ~2000-10000+ | Deep dive into specific data |
|
|
456
|
-
|
|
457
|
-
**Recommended workflow:**
|
|
458
|
-
1. `summary=true` → See the big picture
|
|
459
|
-
2. `level="error"` or `level="warn"` → Focus on problems
|
|
460
|
-
3. `startFromText="..."` → Get logs since specific event
|
|
461
|
-
4. `verbose=true` with low `maxLogs` → Full details when needed
|
|
462
|
-
|
|
463
|
-
#### Message Truncation
|
|
464
|
-
|
|
465
|
-
Long log messages are truncated by default (500 chars). Adjust as needed:
|
|
466
|
-
|
|
467
|
-
```
|
|
468
|
-
# Shorter for overview
|
|
469
|
-
get_logs with maxMessageLength=200
|
|
470
|
-
|
|
471
|
-
# Full messages (use with lower maxLogs)
|
|
472
|
-
get_logs with maxLogs=10 verbose=true
|
|
473
|
-
|
|
474
|
-
# Unlimited
|
|
475
|
-
get_logs with maxMessageLength=0
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
#### TONL Format
|
|
479
|
-
|
|
480
|
-
Use TONL (Token-Optimized Notation Language) for ~30-50% smaller output:
|
|
481
|
-
|
|
482
|
-
```
|
|
483
|
-
get_logs with format="tonl"
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
Output:
|
|
487
|
-
|
|
488
|
-
```
|
|
489
|
-
[Format: TONL - compact token-optimized format. Fields in header, values in rows.]
|
|
490
|
-
{logs:[{time:"14:32:45",level:"LOG",msg:"App started"},{time:"14:32:46",level:"WARN",msg:"Slow query"}]}
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
TONL is also available for `search_logs`, `get_network_requests`, and `search_network`.
|
|
494
|
-
|
|
495
|
-
## Network Tracking
|
|
496
|
-
|
|
497
|
-
### SDK for Full Network Capture (Recommended)
|
|
498
|
-
|
|
499
|
-
For complete network capture including **startup requests**, **full headers**, and **response bodies**, install the companion SDK in your React Native app:
|
|
500
|
-
|
|
501
|
-
```bash
|
|
502
|
-
npm install react-native-ai-devtools-sdk
|
|
503
|
-
```
|
|
504
|
-
|
|
505
|
-
Add to your app's entry file (e.g., `index.js` or `app/_layout.tsx`) — **must be the first import**:
|
|
506
|
-
|
|
507
|
-
```js
|
|
508
|
-
import { init } from 'react-native-ai-devtools-sdk';
|
|
509
|
-
if (__DEV__) {
|
|
510
|
-
init();
|
|
511
|
-
}
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
**What the SDK captures that basic mode doesn't:**
|
|
515
|
-
|
|
516
|
-
| | Without SDK | With SDK |
|
|
517
|
-
|---|---|---|
|
|
518
|
-
| Startup requests (auth, config) | Missed | Captured |
|
|
519
|
-
| Request/response headers | Partial | Full |
|
|
520
|
-
| Request body (GraphQL queries) | No | Full |
|
|
521
|
-
| Response body | No | Full |
|
|
522
|
-
| Works on Bridgeless (Expo SDK 52+) | Partial | Full |
|
|
523
|
-
| Setup required | None | One import |
|
|
524
|
-
|
|
525
|
-
The SDK patches `fetch` at import time and stores data in an in-app buffer. The MCP tools automatically detect the SDK and read from it — no configuration needed.
|
|
526
|
-
|
|
527
|
-
**Without the SDK**, network tracking still works via CDP (Chrome DevTools Protocol) on supported targets, but may miss early requests and won't include response bodies.
|
|
528
|
-
|
|
529
|
-
### View Recent Requests
|
|
530
|
-
|
|
531
|
-
```
|
|
532
|
-
get_network_requests with maxRequests=20
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
### Filter by Method
|
|
536
|
-
|
|
537
|
-
```
|
|
538
|
-
get_network_requests with method="POST"
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
### Filter by Status Code
|
|
542
|
-
|
|
543
|
-
Useful for debugging auth issues:
|
|
544
|
-
|
|
545
|
-
```
|
|
546
|
-
get_network_requests with status=401
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
### Search by URL
|
|
550
|
-
|
|
551
|
-
```
|
|
552
|
-
search_network with urlPattern="api/auth"
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
### Get Full Request Details
|
|
556
|
-
|
|
557
|
-
After finding a request ID from `get_network_requests`:
|
|
558
|
-
|
|
559
|
-
```
|
|
560
|
-
get_request_details with requestId="sdk-abc-1"
|
|
561
|
-
```
|
|
562
|
-
|
|
563
|
-
Shows full headers, request body, response headers, response body, and timing.
|
|
564
|
-
|
|
565
|
-
Body is truncated by default (500 chars). For full body:
|
|
566
|
-
|
|
567
|
-
```
|
|
568
|
-
get_request_details with requestId="sdk-abc-1" verbose=true
|
|
569
|
-
```
|
|
570
|
-
|
|
571
|
-
### Summary Mode (Recommended First Step)
|
|
572
|
-
|
|
573
|
-
Get statistics overview before fetching full requests:
|
|
574
|
-
|
|
575
|
-
```
|
|
576
|
-
get_network_requests with summary=true
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
This returns the same output as `get_network_stats` - counts by method, status, and domain.
|
|
580
|
-
|
|
581
|
-
### TONL Format
|
|
582
|
-
|
|
583
|
-
Use TONL for ~30-50% smaller output:
|
|
584
|
-
|
|
585
|
-
```
|
|
586
|
-
get_network_requests with format="tonl"
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
### View Statistics
|
|
590
|
-
|
|
591
|
-
```
|
|
592
|
-
get_network_stats
|
|
593
|
-
```
|
|
594
|
-
|
|
595
|
-
Example output:
|
|
596
|
-
|
|
597
|
-
```
|
|
598
|
-
Total requests: 47
|
|
599
|
-
Completed: 45
|
|
600
|
-
Errors: 2
|
|
601
|
-
Avg duration: 234ms
|
|
602
|
-
|
|
603
|
-
By Method:
|
|
604
|
-
GET: 32
|
|
605
|
-
POST: 15
|
|
606
|
-
|
|
607
|
-
By Status:
|
|
608
|
-
2xx: 43
|
|
609
|
-
4xx: 2
|
|
610
|
-
|
|
611
|
-
By Domain:
|
|
612
|
-
api.example.com: 40
|
|
613
|
-
cdn.example.com: 7
|
|
614
|
-
```
|
|
615
|
-
|
|
616
|
-
## Debug Web Dashboard
|
|
617
|
-
|
|
618
|
-
The MCP server includes a built-in web dashboard for viewing logs and network requests in your browser. This is useful for real-time monitoring without using MCP tools.
|
|
619
|
-
|
|
620
|
-
### Getting the Dashboard URL
|
|
621
|
-
|
|
622
|
-
Use the `get_debug_server` tool to find the dashboard URL:
|
|
623
|
-
|
|
624
|
-
```
|
|
625
|
-
get_debug_server
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
The server automatically finds an available port starting from 3456. Each MCP instance gets its own port, so multiple Claude Code sessions can run simultaneously.
|
|
629
|
-
|
|
630
|
-
### Available Pages
|
|
631
|
-
|
|
632
|
-
| URL | Description |
|
|
633
|
-
| ---------- | ---------------------------------------------- |
|
|
634
|
-
| `/` | Dashboard with overview stats |
|
|
635
|
-
| `/logs` | Console logs with color-coded levels |
|
|
636
|
-
| `/network` | Network requests with expandable details |
|
|
637
|
-
| `/apps` | Connected React Native apps |
|
|
638
|
-
|
|
639
|
-
### Features
|
|
640
|
-
|
|
641
|
-
- **Auto-refresh** - Pages update automatically every 3 seconds
|
|
642
|
-
- **Color-coded logs** - Errors (red), warnings (yellow), info (blue), debug (gray)
|
|
643
|
-
- **Expandable network requests** - Click any request to see full details:
|
|
644
|
-
- Request/response headers
|
|
645
|
-
- Request body (with JSON formatting)
|
|
646
|
-
- Timing information
|
|
647
|
-
- Error details
|
|
648
|
-
- **GraphQL support** - Shows operation name and variables in compact view:
|
|
649
|
-
```
|
|
650
|
-
POST 200 https://api.example.com/graphql 1ms ▶
|
|
651
|
-
GetMeetingsBasic (timeFilter: "Future", first: 20)
|
|
652
|
-
```
|
|
653
|
-
- **REST body preview** - Shows JSON body preview for non-GraphQL requests
|
|
654
|
-
|
|
655
|
-
### JSON API Endpoints
|
|
656
|
-
|
|
657
|
-
For programmatic access, JSON endpoints are also available:
|
|
658
|
-
|
|
659
|
-
| URL | Description |
|
|
660
|
-
| -------------------- | ----------------------------- |
|
|
661
|
-
| `/api/status` | Server status and buffer sizes |
|
|
662
|
-
| `/api/logs` | All logs as JSON |
|
|
663
|
-
| `/api/network` | All network requests as JSON |
|
|
664
|
-
| `/api/bundle-errors` | Metro bundle errors as JSON |
|
|
665
|
-
| `/api/apps` | Connected apps as JSON |
|
|
666
|
-
|
|
667
|
-
## App Inspection
|
|
668
|
-
|
|
669
|
-
### Discover Debug Globals
|
|
670
|
-
|
|
671
|
-
Find what debugging objects are available in your app:
|
|
672
|
-
|
|
673
|
-
```
|
|
674
|
-
list_debug_globals
|
|
675
|
-
```
|
|
676
|
-
|
|
677
|
-
Example output:
|
|
678
|
-
|
|
679
|
-
```json
|
|
680
|
-
{
|
|
681
|
-
"Apollo Client": ["__APOLLO_CLIENT__"],
|
|
682
|
-
"Redux": ["__REDUX_STORE__"],
|
|
683
|
-
"Expo": ["__EXPO_ROUTER__"],
|
|
684
|
-
"Reanimated": ["__reanimatedModuleProxy"]
|
|
685
|
-
}
|
|
686
|
-
```
|
|
687
|
-
|
|
688
|
-
### Inspect an Object
|
|
689
|
-
|
|
690
|
-
Before calling methods on an unfamiliar object, inspect it to see what's callable:
|
|
691
|
-
|
|
692
|
-
```
|
|
693
|
-
inspect_global with objectName="__EXPO_ROUTER__"
|
|
694
|
-
```
|
|
695
|
-
|
|
696
|
-
Example output:
|
|
697
|
-
|
|
698
|
-
```json
|
|
699
|
-
{
|
|
700
|
-
"navigate": { "type": "function", "callable": true },
|
|
701
|
-
"push": { "type": "function", "callable": true },
|
|
702
|
-
"currentPath": { "type": "string", "callable": false, "value": "/" },
|
|
703
|
-
"routes": { "type": "array", "callable": false }
|
|
704
|
-
}
|
|
705
|
-
```
|
|
706
|
-
|
|
707
|
-
### Execute Code in App
|
|
708
|
-
|
|
709
|
-
Run simple JavaScript expressions using globals discovered via `list_debug_globals`:
|
|
209
|
+
## Detailed Guides
|
|
710
210
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
```
|
|
721
|
-
|
|
722
|
-
**Limitations (Hermes engine):**
|
|
723
|
-
- No `require()` or `import` — only pre-existing globals are available
|
|
724
|
-
- No `async/await` syntax — use simple expressions or promise chains (`.then()`)
|
|
725
|
-
- No emoji or non-ASCII characters in string literals — causes parse errors
|
|
726
|
-
- Keep expressions simple and synchronous when possible
|
|
727
|
-
|
|
728
|
-
## React Component Inspection
|
|
729
|
-
|
|
730
|
-
Inspect React components at runtime via the React DevTools hook. These tools let you debug component state, verify layouts, and understand app structure without adding console.logs.
|
|
731
|
-
|
|
732
|
-
### Recommended Workflow (Token-Efficient)
|
|
733
|
-
|
|
734
|
-
**Always use the 2-step approach:**
|
|
735
|
-
|
|
736
|
-
1. **Step 1: Get focused screen overview** (~1-3KB)
|
|
737
|
-
```
|
|
738
|
-
get_component_tree with focusedOnly=true structureOnly=true
|
|
739
|
-
```
|
|
740
|
-
|
|
741
|
-
2. **Step 2: Drill down** into specific components as needed
|
|
742
|
-
```
|
|
743
|
-
inspect_component with componentName="HomeScreen"
|
|
744
|
-
# or
|
|
745
|
-
find_components with pattern="Button" includeLayout=true
|
|
746
|
-
```
|
|
747
|
-
|
|
748
|
-
This approach uses **~10-20x fewer tokens** than getting full details upfront.
|
|
749
|
-
|
|
750
|
-
### Token Consumption Comparison
|
|
751
|
-
|
|
752
|
-
| Approach | Tokens | Use Case |
|
|
753
|
-
|----------|--------|----------|
|
|
754
|
-
| `focusedOnly=true, structureOnly=true` | ~1-3KB | **Recommended** - active screen structure only |
|
|
755
|
-
| `structureOnly=true` | ~15-25KB | Full tree structure (includes navigation, overlays) |
|
|
756
|
-
| `inspect_component` | ~1-2KB | Deep dive into specific component |
|
|
757
|
-
| `find_components` | ~2-5KB | Targeted search with layout |
|
|
758
|
-
| `get_screen_layout` | ~20-50KB+ | Full layout (use sparingly) |
|
|
759
|
-
|
|
760
|
-
### Focused Screen Mode (`focusedOnly`)
|
|
761
|
-
|
|
762
|
-
The `focusedOnly` parameter dramatically reduces output by returning only the active screen subtree:
|
|
763
|
-
|
|
764
|
-
- **Skips navigation wrappers** - Providers, NavigationContainers, SafeAreaProviders
|
|
765
|
-
- **Skips global overlays** - BottomSheet, Modal, Toast, Snackbar components
|
|
766
|
-
- **Returns just the focused screen** - Components matching `*Screen` or `*Page` pattern
|
|
767
|
-
|
|
768
|
-
```
|
|
769
|
-
get_component_tree with focusedOnly=true structureOnly=true
|
|
770
|
-
```
|
|
771
|
-
|
|
772
|
-
Output:
|
|
773
|
-
|
|
774
|
-
```
|
|
775
|
-
Focused: HomeScreen
|
|
776
|
-
|
|
777
|
-
HomeScreen
|
|
778
|
-
Header
|
|
779
|
-
Logo
|
|
780
|
-
SearchBar
|
|
781
|
-
FlatList
|
|
782
|
-
ListItem (×12)
|
|
783
|
-
Footer
|
|
784
|
-
```
|
|
785
|
-
|
|
786
|
-
**When to skip `focusedOnly`:**
|
|
787
|
-
- Debugging navigation structure itself
|
|
788
|
-
- Investigating which screens are mounted
|
|
789
|
-
- Checking global overlay state
|
|
790
|
-
|
|
791
|
-
### Inspecting Overlays (BottomSheet, Modal, Toast)
|
|
792
|
-
|
|
793
|
-
Since `focusedOnly` skips global overlays by design, use this workflow to debug them:
|
|
794
|
-
|
|
795
|
-
1. **Find the overlay component:**
|
|
796
|
-
```
|
|
797
|
-
find_components with pattern="BottomSheet|Modal|Toast"
|
|
798
|
-
```
|
|
799
|
-
|
|
800
|
-
2. **Inspect its state/props:**
|
|
801
|
-
```
|
|
802
|
-
inspect_component with componentName="MyBottomSheet"
|
|
803
|
-
```
|
|
804
|
-
|
|
805
|
-
This targeted approach uses ~2-4KB vs ~20KB+ for the full tree.
|
|
806
|
-
|
|
807
|
-
### Step 1: Get Component Tree
|
|
808
|
-
|
|
809
|
-
View the React component hierarchy with minimal data:
|
|
810
|
-
|
|
811
|
-
```
|
|
812
|
-
# Focused screen only (recommended)
|
|
813
|
-
get_component_tree with focusedOnly=true structureOnly=true
|
|
814
|
-
|
|
815
|
-
# Full tree structure
|
|
816
|
-
get_component_tree with structureOnly=true
|
|
817
|
-
```
|
|
818
|
-
|
|
819
|
-
Output (ultra-compact):
|
|
820
|
-
|
|
821
|
-
```
|
|
822
|
-
Focused: HomeScreen
|
|
823
|
-
|
|
824
|
-
HomeScreen
|
|
825
|
-
Header
|
|
826
|
-
FlatList
|
|
827
|
-
Footer
|
|
828
|
-
```
|
|
829
|
-
|
|
830
|
-
This gives you the focused screen structure in just 1-3KB.
|
|
831
|
-
|
|
832
|
-
### Step 2a: Inspect Specific Component
|
|
833
|
-
|
|
834
|
-
After identifying a component in the structure, drill down:
|
|
835
|
-
|
|
836
|
-
```
|
|
837
|
-
inspect_component with componentName="HomeScreen"
|
|
838
|
-
```
|
|
839
|
-
|
|
840
|
-
Output:
|
|
841
|
-
|
|
842
|
-
```json
|
|
843
|
-
{
|
|
844
|
-
"component": "HomeScreen",
|
|
845
|
-
"path": "... > Navigator > HomeScreen",
|
|
846
|
-
"props": {
|
|
847
|
-
"navigation": "[Object]",
|
|
848
|
-
"route": { "name": "Home", "key": "home-xyz" }
|
|
849
|
-
},
|
|
850
|
-
"hooks": [
|
|
851
|
-
{ "hookIndex": 0, "value": false },
|
|
852
|
-
{ "hookIndex": 3, "value": 42 }
|
|
853
|
-
]
|
|
854
|
-
}
|
|
855
|
-
```
|
|
856
|
-
|
|
857
|
-
Options:
|
|
858
|
-
- `includeChildren=true` - Include children tree
|
|
859
|
-
- `childrenDepth=2` - How deep to show children (1=direct only, 2+=nested tree)
|
|
860
|
-
- `includeState=false` - Skip hooks/state (faster)
|
|
861
|
-
- `index=1` - Inspect 2nd instance if multiple exist
|
|
862
|
-
|
|
863
|
-
### Step 2b: Find Components by Pattern
|
|
864
|
-
|
|
865
|
-
Search for components and optionally get their layout:
|
|
866
|
-
|
|
867
|
-
```
|
|
868
|
-
find_components with pattern="Screen$" includeLayout=true
|
|
869
|
-
```
|
|
870
|
-
|
|
871
|
-
Output:
|
|
872
|
-
|
|
873
|
-
```
|
|
874
|
-
pattern: Screen$
|
|
875
|
-
found: 5
|
|
876
|
-
#found{component,path,depth,key,layout}
|
|
877
|
-
HomeScreen|... > Navigator > HomeScreen|45|paddingHorizontal:16|
|
|
878
|
-
SettingsScreen|... > Navigator > SettingsScreen|45|flex:1|
|
|
879
|
-
```
|
|
880
|
-
|
|
881
|
-
Options:
|
|
882
|
-
- `includeLayout=true` - Include flex, padding, margin values
|
|
883
|
-
- `summary=true` - Get counts only (e.g., "HomeScreen: 1")
|
|
884
|
-
- `maxResults=10` - Limit number of results
|
|
885
|
-
|
|
886
|
-
### Full Layout (Use Sparingly)
|
|
887
|
-
|
|
888
|
-
For detailed layout of all visible components:
|
|
889
|
-
|
|
890
|
-
```
|
|
891
|
-
get_screen_layout
|
|
892
|
-
```
|
|
893
|
-
|
|
894
|
-
**Warning**: This returns ~20-50KB for complex screens. Use `find_components` with `includeLayout=true` instead for targeted queries.
|
|
895
|
-
|
|
896
|
-
### Use Cases
|
|
897
|
-
|
|
898
|
-
**Figma Alignment / Layout Verification**
|
|
899
|
-
```
|
|
900
|
-
# Step 1: See focused screen structure
|
|
901
|
-
get_component_tree with focusedOnly=true structureOnly=true
|
|
902
|
-
|
|
903
|
-
# Step 2: Get layout for specific components
|
|
904
|
-
find_components with pattern="Header|Footer|Button" includeLayout=true
|
|
905
|
-
```
|
|
906
|
-
|
|
907
|
-
**Debug State Changes**
|
|
908
|
-
```
|
|
909
|
-
# Check hook values before action
|
|
910
|
-
inspect_component with componentName="LoginForm"
|
|
911
|
-
# → hookIndex 2: false (isLoading)
|
|
912
|
-
|
|
913
|
-
# After user action, check again
|
|
914
|
-
inspect_component with componentName="LoginForm"
|
|
915
|
-
# → hookIndex 2: true (isLoading changed!)
|
|
916
|
-
```
|
|
917
|
-
|
|
918
|
-
**Debug Navigation Issues**
|
|
919
|
-
```
|
|
920
|
-
# Find which screen is currently mounted (use full tree)
|
|
921
|
-
get_component_tree with structureOnly=true
|
|
922
|
-
# or
|
|
923
|
-
find_components with pattern="Screen$"
|
|
924
|
-
|
|
925
|
-
# Check if a screen rendered multiple times (memory leak)
|
|
926
|
-
find_components with pattern="HomeScreen" summary=true
|
|
927
|
-
```
|
|
928
|
-
|
|
929
|
-
**Debug Overlays (BottomSheet, Modal, Toast)**
|
|
930
|
-
```
|
|
931
|
-
# Find and inspect overlay components
|
|
932
|
-
find_components with pattern="BottomSheet|Modal"
|
|
933
|
-
|
|
934
|
-
# Get overlay props/state
|
|
935
|
-
inspect_component with componentName="PaywallModal"
|
|
936
|
-
```
|
|
937
|
-
|
|
938
|
-
**Understand Unfamiliar Codebase**
|
|
939
|
-
```
|
|
940
|
-
# Quick focused screen overview
|
|
941
|
-
get_component_tree with focusedOnly=true structureOnly=true
|
|
942
|
-
|
|
943
|
-
# Full app structure (navigation, providers)
|
|
944
|
-
get_component_tree with structureOnly=true
|
|
945
|
-
|
|
946
|
-
# Find all button variants
|
|
947
|
-
find_components with pattern="Button"
|
|
948
|
-
|
|
949
|
-
# Find all context providers
|
|
950
|
-
find_components with pattern="Provider$"
|
|
951
|
-
```
|
|
952
|
-
|
|
953
|
-
## Device Interaction
|
|
954
|
-
|
|
955
|
-
### Android (requires ADB)
|
|
956
|
-
|
|
957
|
-
List connected devices:
|
|
958
|
-
|
|
959
|
-
```
|
|
960
|
-
list_android_devices
|
|
961
|
-
```
|
|
962
|
-
|
|
963
|
-
Take a screenshot:
|
|
964
|
-
|
|
965
|
-
```
|
|
966
|
-
android_screenshot
|
|
967
|
-
```
|
|
968
|
-
|
|
969
|
-
Tap on screen:
|
|
970
|
-
|
|
971
|
-
```
|
|
972
|
-
tap with x=540 y=960
|
|
973
|
-
```
|
|
974
|
-
|
|
975
|
-
Swipe gesture:
|
|
976
|
-
|
|
977
|
-
```
|
|
978
|
-
android_swipe with startX=540 startY=1500 endX=540 endY=500
|
|
979
|
-
```
|
|
980
|
-
|
|
981
|
-
Type text (tap input field first):
|
|
982
|
-
|
|
983
|
-
```
|
|
984
|
-
tap with x=540 y=400
|
|
985
|
-
android_input_text with text="hello@example.com"
|
|
986
|
-
```
|
|
987
|
-
|
|
988
|
-
Send key events:
|
|
989
|
-
|
|
990
|
-
```
|
|
991
|
-
android_key_event with key="BACK"
|
|
992
|
-
android_key_event with key="HOME"
|
|
993
|
-
android_key_event with key="ENTER"
|
|
994
|
-
```
|
|
995
|
-
|
|
996
|
-
### iOS Simulator (requires Xcode)
|
|
997
|
-
|
|
998
|
-
List available simulators:
|
|
999
|
-
|
|
1000
|
-
```
|
|
1001
|
-
list_ios_simulators
|
|
1002
|
-
```
|
|
1003
|
-
|
|
1004
|
-
Boot a simulator:
|
|
1005
|
-
|
|
1006
|
-
```
|
|
1007
|
-
ios_boot_simulator with udid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
|
|
1008
|
-
```
|
|
1009
|
-
|
|
1010
|
-
Take a screenshot:
|
|
1011
|
-
|
|
1012
|
-
```
|
|
1013
|
-
ios_screenshot
|
|
1014
|
-
```
|
|
1015
|
-
|
|
1016
|
-
Launch an app:
|
|
1017
|
-
|
|
1018
|
-
```
|
|
1019
|
-
ios_launch_app with bundleId="com.example.myapp"
|
|
1020
|
-
```
|
|
1021
|
-
|
|
1022
|
-
Open a deep link:
|
|
1023
|
-
|
|
1024
|
-
```
|
|
1025
|
-
ios_open_url with url="myapp://settings"
|
|
1026
|
-
```
|
|
1027
|
-
|
|
1028
|
-
## UI Interaction
|
|
1029
|
-
|
|
1030
|
-
### Unified `tap` Tool (Recommended)
|
|
1031
|
-
|
|
1032
|
-
The `tap` tool is the simplest way to interact with UI elements. It automatically tries multiple strategies and handles platform detection and coordinate conversion:
|
|
1033
|
-
|
|
1034
|
-
```
|
|
1035
|
-
# By visible text — tries fiber tree, accessibility, then OCR
|
|
1036
|
-
tap with text="Submit"
|
|
1037
|
-
|
|
1038
|
-
# By testID prop
|
|
1039
|
-
tap with testID="login-btn"
|
|
1040
|
-
|
|
1041
|
-
# By React component name (fiber tree only)
|
|
1042
|
-
tap with component="HamburgerIcon"
|
|
1043
|
-
|
|
1044
|
-
# By pixel coordinates from screenshot (auto-converts to points on iOS)
|
|
1045
|
-
tap with x=300 y=600
|
|
1046
|
-
|
|
1047
|
-
# Force a specific strategy
|
|
1048
|
-
tap with text="Menu" strategy="ocr"
|
|
1049
|
-
```
|
|
1050
|
-
|
|
1051
|
-
**Fallback chain:** fiber tree (direct `onPress`) → accessibility tree → OCR → error with suggestion.
|
|
1052
|
-
|
|
1053
|
-
On failure, the response includes an actionable `suggestion` telling the agent exactly what to try next.
|
|
1054
|
-
|
|
1055
|
-
**Screenshot & verification:** By default, `tap` captures and returns a post-tap screenshot (`screenshot=true`). For coordinate, accessibility, and OCR strategies, it also runs a before/after screenshot diff to verify the tap had a meaningful visual effect (`verify=true` by default for these strategies, `false` for fiber). Set `screenshot=false` to skip screenshots entirely for fastest execution, or `verify=false` to skip the diff check.
|
|
1056
|
-
|
|
1057
|
-
### Platform-Specific Tools
|
|
1058
|
-
|
|
1059
|
-
For gestures beyond tapping, use platform-specific tools:
|
|
1060
|
-
|
|
1061
|
-
```
|
|
1062
|
-
# Swipe
|
|
1063
|
-
ios_swipe with startX=200 startY=400 endX=200 endY=100
|
|
1064
|
-
android_swipe with startX=540 startY=1500 endX=540 endY=500
|
|
1065
|
-
|
|
1066
|
-
# Text input (tap input field first)
|
|
1067
|
-
tap with text="Email"
|
|
1068
|
-
ios_input_text with text="hello@example.com"
|
|
1069
|
-
|
|
1070
|
-
# Key events
|
|
1071
|
-
android_key_event with key="BACK"
|
|
1072
|
-
ios_button with button="HOME"
|
|
1073
|
-
```
|
|
1074
|
-
|
|
1075
|
-
### Wait for Screen Transitions
|
|
1076
|
-
|
|
1077
|
-
```
|
|
1078
|
-
android_wait_for_element with text="Dashboard" timeoutMs=15000
|
|
1079
|
-
ios_wait_for_element with label="Home" timeoutMs=10000
|
|
1080
|
-
```
|
|
1081
|
-
|
|
1082
|
-
## OCR Text Extraction
|
|
1083
|
-
|
|
1084
|
-
The `ocr_screenshot` tool extracts all visible text from a screenshot with tap-ready coordinates. This is useful when accessibility labels are missing or when you need to find text that isn't exposed in the accessibility tree.
|
|
1085
|
-
|
|
1086
|
-
### Why OCR?
|
|
1087
|
-
|
|
1088
|
-
| Approach | Pros | Cons |
|
|
1089
|
-
|----------|------|------|
|
|
1090
|
-
| Accessibility tree (`find_element`) | Fast, reliable, low token usage | Only finds elements with accessibility labels |
|
|
1091
|
-
| Screenshot + Vision | Visual layout understanding | High token usage, slow |
|
|
1092
|
-
| **OCR** | Works on ANY visible text, returns tap coordinates | Requires text to be visible, may miss small text |
|
|
1093
|
-
|
|
1094
|
-
### Usage
|
|
1095
|
-
|
|
1096
|
-
```
|
|
1097
|
-
ocr_screenshot with platform="ios"
|
|
1098
|
-
```
|
|
1099
|
-
|
|
1100
|
-
Returns all visible text with tap-ready coordinates:
|
|
1101
|
-
|
|
1102
|
-
```json
|
|
1103
|
-
{
|
|
1104
|
-
"platform": "ios",
|
|
1105
|
-
"engine": "cloud",
|
|
1106
|
-
"processingTimeMs": 550,
|
|
1107
|
-
"elementCount": 24,
|
|
1108
|
-
"elements": [
|
|
1109
|
-
{ "text": "Settings", "confidence": 95, "tapX": 195, "tapY": 52 },
|
|
1110
|
-
{ "text": "Login", "confidence": 95, "tapX": 187, "tapY": 420 }
|
|
1111
|
-
]
|
|
1112
|
-
}
|
|
1113
|
-
```
|
|
1114
|
-
|
|
1115
|
-
Then tap the element:
|
|
1116
|
-
|
|
1117
|
-
```
|
|
1118
|
-
tap with x=187 y=420
|
|
1119
|
-
```
|
|
1120
|
-
|
|
1121
|
-
### OCR Engine
|
|
1122
|
-
|
|
1123
|
-
OCR uses **Google Cloud Vision API** via a cloud proxy for fast, accurate text recognition (~97%+ accuracy, ~0.5s processing time). This works out of the box with no local dependencies.
|
|
1124
|
-
|
|
1125
|
-
Screenshots are sent over HTTPS to our cloud endpoint for processing and immediately deleted after recognition — no images are stored.
|
|
1126
|
-
|
|
1127
|
-
### Offline Fallback (EasyOCR)
|
|
1128
|
-
|
|
1129
|
-
If the cloud endpoint is unreachable (no internet, timeout), OCR falls back to local EasyOCR (Python-based). This requires Python 3.6+:
|
|
1130
|
-
|
|
1131
|
-
```bash
|
|
1132
|
-
# macOS
|
|
1133
|
-
brew install python@3.11
|
|
1134
|
-
|
|
1135
|
-
# Ubuntu/Debian
|
|
1136
|
-
sudo apt install python3
|
|
1137
|
-
```
|
|
1138
|
-
|
|
1139
|
-
EasyOCR and its Python dependencies are installed automatically by `node-easyocr`. The local fallback is slower (~2-3s) and less accurate (~85-90%) but works offline.
|
|
1140
|
-
|
|
1141
|
-
### OCR Language Configuration
|
|
1142
|
-
|
|
1143
|
-
Google Cloud Vision automatically detects and recognizes text in most languages without configuration.
|
|
1144
|
-
|
|
1145
|
-
For the offline EasyOCR fallback, set `EASYOCR_LANGUAGES` to add language support:
|
|
1146
|
-
|
|
1147
|
-
```bash
|
|
1148
|
-
EASYOCR_LANGUAGES=es,fr
|
|
1149
|
-
```
|
|
1150
|
-
|
|
1151
|
-
### Recommended Workflow
|
|
1152
|
-
|
|
1153
|
-
1. **Use unified `tap`** - Handles fallback chain automatically
|
|
1154
|
-
2. **Fall back to OCR** - When `tap` suggests using coordinates
|
|
1155
|
-
3. **Use screenshot** - For visual debugging or layout verification
|
|
1156
|
-
|
|
1157
|
-
```
|
|
1158
|
-
# Simplest approach — tap handles everything
|
|
1159
|
-
tap with text="Submit"
|
|
1160
|
-
|
|
1161
|
-
# If tap fails, use OCR to find coordinates
|
|
1162
|
-
ocr_screenshot with platform="android"
|
|
1163
|
-
|
|
1164
|
-
# Then tap using coordinates from OCR result
|
|
1165
|
-
tap with x=540 y=1200
|
|
1166
|
-
```
|
|
211
|
+
| Guide | Description |
|
|
212
|
+
| ----- | ----------- |
|
|
213
|
+
| [Console Logging](docs/logging.md) | `get_logs` parameters, filtering, summary mode, TONL format, token optimization |
|
|
214
|
+
| [Network Tracking](docs/network.md) | SDK setup for full capture, filtering, request details, statistics |
|
|
215
|
+
| [App Inspection](docs/app-inspection.md) | Debug globals (Apollo, Redux, Expo Router), `execute_in_app`, limitations |
|
|
216
|
+
| [Device Interaction](docs/device-interaction.md) | Unified `tap`, platform-specific gestures, text input, key events |
|
|
217
|
+
| [OCR Text Extraction](docs/ocr.md) | Cloud Vision OCR, offline fallback, language config, workflows |
|
|
218
|
+
| [Claude Code Skills](docs/skills.md) | Pre-built skills for session setup, debugging, and automation |
|
|
219
|
+
| [Full Tool Reference](docs/tools.md) | Complete list of all 40+ tools with descriptions |
|
|
1167
220
|
|
|
1168
221
|
## Supported React Native Versions
|
|
1169
222
|
|
|
1170
|
-
| Version
|
|
1171
|
-
|
|
|
1172
|
-
| Expo SDK 54+
|
|
1173
|
-
| RN 0.
|
|
1174
|
-
| RN
|
|
223
|
+
| Version | Architecture | Engine | Status |
|
|
224
|
+
| ------- | ------------ | ------ | ------ |
|
|
225
|
+
| Expo SDK 54+ | Bridgeless (New Arch) | Hermes | ✓ Fully supported |
|
|
226
|
+
| RN 0.76+ | Bridgeless (New Arch) | Hermes | ✓ Fully supported |
|
|
227
|
+
| RN 0.73 - 0.75 | Bridge (Old Arch) | Hermes | ✓ Fully supported (best network capture via CDP) |
|
|
228
|
+
| RN 0.70 - 0.72 | Bridge (Old Arch) | Hermes / JSC | ✓ Supported |
|
|
229
|
+
| RN < 0.70 | Bridge | JSC | Not tested |
|
|
1175
230
|
|
|
1176
231
|
## How It Works
|
|
1177
232
|
|
|
@@ -1183,20 +238,22 @@ tap with x=540 y=1200
|
|
|
1183
238
|
- **Without SDK**: Enables CDP `Network.enable` (on supported targets) or injects a JS fetch interceptor as fallback
|
|
1184
239
|
5. Stores logs and network requests in circular buffers for retrieval
|
|
1185
240
|
|
|
1186
|
-
##
|
|
241
|
+
## Connection Management
|
|
242
|
+
|
|
243
|
+
### Explicit Connection
|
|
1187
244
|
|
|
1188
|
-
The server
|
|
245
|
+
The server does **not** auto-connect on startup. Call `scan_metro` to discover and connect to Metro servers. This prevents multiple MCP server instances (from parallel agent sessions) from competing for the single CDP WebSocket slot, which would cause connection thrashing and dropped tools.
|
|
1189
246
|
|
|
1190
|
-
###
|
|
247
|
+
### Graceful Shutdown
|
|
1191
248
|
|
|
1192
|
-
When the MCP server
|
|
249
|
+
When the MCP server process is terminated (`SIGINT`/`SIGTERM`), it closes all CDP WebSocket connections and cancels reconnection timers, freeing the CDP slot immediately for other sessions.
|
|
1193
250
|
|
|
1194
251
|
### Reconnection on Disconnect
|
|
1195
252
|
|
|
1196
253
|
When the connection to Metro is lost (e.g., app restart, Metro restart, or network issues):
|
|
1197
254
|
|
|
1198
255
|
1. The server automatically attempts to reconnect
|
|
1199
|
-
2. Uses exponential backoff:
|
|
256
|
+
2. Uses exponential backoff: 500ms, 1s, 2s, 4s, 8s (up to 8 attempts)
|
|
1200
257
|
3. Re-fetches device list to handle new WebSocket URLs
|
|
1201
258
|
4. Preserves existing log and network buffers
|
|
1202
259
|
|