Screen Capture
Tools for capturing screenshots, component tree snapshots, querying native UI trees, and performing visual regression testing.
take_screenshot
Capture the device/simulator screen as a JPEG image (720p).
Parameters
Example
Tips
- Returns base64 JPEG and point size metadata for coordinate conversion.
- Prefer
assert_textorassert_visibleover screenshots when possible — screenshots consume vision tokens. - iOS only supports simulators, not physical devices.
take_snapshot
Capture the React Native component tree. Returns UIDs, types, testIDs, and text content.
Parameters
Example
Tips
- Use
uidvalues withmeasureView(uid)viaevaluate_scriptto get exact coordinates. - Reduce
maxDepthfor large component trees to limit output size. - The snapshot traverses the React Fiber tree, not the native view hierarchy.
describe_ui
Query the native UI/accessibility tree. Returns the full native hierarchy.
Parameters
Example
Tips
- Produces a large payload. Prefer
query_selectorfor querying React Native elements. - iOS uses
idb ui describe-all/describe-point. Android usesuiautomator dump. - Useful for inspecting native components that aren't part of the React tree (e.g., native alerts, system UI).
visual_compare
Compare the current screen against a baseline PNG for visual regression testing.
Parameters
Example
Tips
- Use
updateBaseline: trueto create initial baselines. - Use
selectorto compare only a specific component (e.g.,#header) instead of the full screen. - Lower
thresholdvalues are stricter (0 = pixel-perfect, 1 = any difference passes). - Uses sharp + pixelmatch internally.