debugger-component-tree
Fetches a running React Native app's current screen as a compact component tree with names, text, testIDs, and tap coordinates, helping debug UI structure and build selectors.
Instructions
Fetch the current screen of a running React Native app as a compact tree of React components. Each on-screen component is listed with its name, its text (or accessibilityLabel when it has no text), [testID=…] and its center as (tap: x,y) fractions of the screen. Full-screen transparent wrappers and implementation-detail components are pruned. Wrappers the size of their parent are pruned too, so a missing name proves nothing: check with debugger-inspect-element.
Use when you need what describe does not show: a testID for a selector (on Android, describe omits the testID of a view that has no label and is not tappable), or the component names and nesting behind the screen before editing code. To find what to tap, use describe.
Returns a compact text tree; call again after navigation. Fails if the Metro debugger is disconnected.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"device_id": "<device_id>"
},
"name": "debugger-component-tree"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. Range: 1 to 65535. | |
| 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 used with debugger-connect. | |
| onScreenOnly | No | When true, only components visible on screen are returned. Set to false to include all mounted components, including those scrolled off-screen, e.g. to understand the full page structure. Default: true. | |
| includeSkipped | No | When true, appends a summary of all filtered components: total fiber count and skip counts by component name and by filter. Default: false. |