Element Query
Tools for finding elements in the React Native component tree and executing JavaScript in the app or WebView context.
query_selector
Find the first element matching a selector in the React Fiber tree. Returns UID, type, and measurement (position + size).
Parameters
Example
Tips
- This is the entry point for most interaction workflows:
query_selector→ get coordinates →tap. - Tap the center of an element:
x = pageX + width/2,y = pageY + height/2. - UIDs are not known ahead of time — always call
query_selectorfirst to discover them.
query_selector_all
Find all elements matching a selector. Returns an array with measurements.
Parameters
Example
Tips
- Prefer
query_selectorwhen you only need one element. - Use this to enumerate lists, count visible items, or iterate over multiple matches.
evaluate_script
Run JavaScript in the app's runtime context. Use measureView(uid) to get tap/swipe coordinates.
Parameters
Example
Tips
measureView(uid)returns{ pageX, pageY, width, height }— useful for computing tap targets.require()is not available. Only access globals and the built-in MCP helpers.- The function is wrapped in a try-catch and executed via WebSocket.
webview_evaluate_script
Run JavaScript inside an in-app WebView. Useful for DOM manipulation, form filling, or reading web content.
Parameters
Example
Tips
- Prefer this over
tapfor WebView DOM interactions — it's faster and more reliable. - WebViews are auto-registered by the babel plugin. Use
getRegisteredWebViewIds()to discover available IDs. - The script must evaluate to a value to return a result. End with a string or expression.