debugger-component-tree
Get tap coordinates for React Native UI elements by fetching the on-screen component tree, with normalized coordinates for direct use in tap gestures. Prunes off-screen and wrapper components to show only actionable elements.
Instructions
Fetch the current screen of a running React Native app as a compact component text tree. Only shows on-screen components with unique positions — off-screen (scrolled) content, full-screen transparent wrappers, and implementation-detail components are pruned.
Each visible component is listed with its name, text content, and normalized tap coordinates in [0,1] space (fractions of the screen, not pixels — same space as tap/swipe/gesture). On an iOS simulator with a landscape UI (a rotated device, or an unfolded foldable), the tap coordinates are on the screen's axes, which the gesture tools use. When two or more devices share one Metro, pass the simulator's udid too. If the result says that the orientation could not be read, take tap coordinates from describe.
This is the preferred element discovery tool for React Native apps. More information in argent-react-native-app-workflow skill.
Workflow:
Call this tool to get the component tree.
Find the desired element by name, text, testID, or accessibilityLabel.
Use the (tap: x,y) coordinates directly with the tap tool.
Call again after navigation or state changes since positions may shift. Set includeSkipped=true to see a summary of all filtered components. Use when you need tap coordinates for a React Native UI element. Returns a compact text tree with (tap: x,y) coords. Fails if Metro debugger is not connected.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | Metro server port. Optional — omit it to use this device's port, 8081 by default. Ignored for Chromium, whose CDP port is encoded in device_id. | |
| udid | No | iOS simulator UDID from list-devices. Pass it when device_id is a logicalDeviceId (two or more devices share one Metro), so that the tap coordinates of a landscape UI are on the screen's axes. | |
| maxNodes | No | Maximum total nodes to include. When exceeded, intermediate single-child wrapper chains are collapsed to preserve both root structure and leaf elements. Default: no limit. | |
| device_id | Yes | Device id from list-devices — the SAME id you passed to debugger-connect (iOS simulator UDID or Android serial). | |
| onScreenOnly | No | When true (default), only components visible on screen are returned. Set to false to include all mounted components including those scrolled off-screen. Useful when you need to understand the full page structure. | |
| includeSkipped | No | When true, appends a summary of all filtered components: total fiber count, JS-side skip counts by name, and TS-side filter pass removals. Useful for understanding what was pruned from the tree. |