Skip to content

Reference

cdp_component_tree

Get React component tree. Returns components with props, state, testIDs. Use filter to scope to a specific subtree — NEVER request full tree unless necessary (saves tokens). Detects RedBox and warns. Pass interactiveOnly=true for a compact “what can I act on here?” digest (only tappable/editable elements + their text, no props/state) — the cheapest way to perceive a novel screen for live interaction.

NameTypeRequiredDefaultConstraintsDescription
filterstringNoCase-insensitive substring match against component name, testID/nativeID, or accessibilityLabel (e.g. “CartBadge”, “product-list”, “Continue”)
depthnumberNo4min: 1, max: 12, integerMax depth (default 4, max 12)
interactiveOnlybooleanNoReturn a compact salient digest: only actionable nodes (Pressable/Button/TextInput/Switch/Link + accessibilityRole controls) with {testID, role, text, label}, dropping props/hookStates/nesting. Ignores filter/depth. Use to cheaply see what is tappable on the current screen.
cdp_component_tree()