AdbTools
UI Actions - Core UI interaction tools for Android device control.
AdbTools
Core UI interaction tools for Android device control.
AdbTools.__init__
Initialize the AdbTools instance.
Arguments:
serial
- Device serial number
AdbTools.create
Create an AdbTools instance.
Arguments:
serial
- Optional device serial number. If not provided, the first device found will be used.
Returns:
AdbTools instance
AdbTools.tap_by_index
Tap on a UI element by its index.
This function uses the cached clickable elements to find the element with the given index and tap on its center coordinates.
Arguments:
index
- Index of the element to tap
Returns:
Result message
AdbTools.tap_by_coordinates
Tap on the device screen at specific coordinates.
Arguments:
x
- X coordinatey
- Y coordinate
Returns:
Bool indicating success or failure
AdbTools.tap
Tap on a UI element by its index.
This function uses the cached clickable elements from the last get_clickables call to find the element with the given index and tap on its center coordinates.
Arguments:
index
- Index of the element to tap
Returns:
Result message
AdbTools.swipe
Performs a straight-line swipe gesture on the device screen. To perform a hold (long press), set the start and end coordinates to the same values and increase the duration as needed.
Arguments:
start_x
- Starting X coordinatestart_y
- Starting Y coordinateend_x
- Ending X coordinateend_y
- Ending Y coordinateduration_ms
- Duration of swipe in milliseconds
Returns:
Bool indicating success or failure
AdbTools.input_text
Input text on the device. Always make sure that the Focused Element is not None before inputting text.
Arguments:
text
- Text to input. Can contain spaces, newlines, and special characters including non-ASCII.
Returns:
Result message
AdbTools.back
Go back on the current view. This presses the Android back button.
AdbTools.press_key
Press a key on the Android device.
Common keycodes:
- 3: HOME
- 4: BACK
- 66: ENTER
- 67: DELETE
Arguments:
keycode
- Android keycode to press
AdbTools.start_app
Start an app on the device.
Arguments:
package
- Package name (e.g., “com.android.settings”)activity
- Optional activity name
AdbTools.install_app
Install an app on the device.
Arguments:
apk_path
- Path to the APK filereinstall
- Whether to reinstall if app existsgrant_permissions
- Whether to grant all permissions
AdbTools.take_screenshot
Take a screenshot of the device. This function captures the current screen and adds the screenshot to context in the next message. Also stores the screenshot in the screenshots list with timestamp for later GIF creation.
AdbTools.list_packages
List installed packages on the device.
Arguments:
include_system_apps
- Whether to include system apps (default: False)
Returns:
List of package names
AdbTools.complete
Mark the task as finished.
Arguments:
success
- Indicates if the task was successful.reason
- Reason for failure/success
AdbTools.remember
Store important information to remember for future context.
This information will be extracted and included into your next steps to maintain context across interactions. Use this for critical facts, observations, or user preferences that should influence future decisions.
Arguments:
information
- The information to remember
Returns:
Confirmation message
AdbTools.get_memory
Retrieve all stored memory items.
Returns:
List of stored memory items
AdbTools.get_state
Get both the a11y tree and phone state in a single call using the combined /state endpoint.
Arguments:
serial
- Optional device serial number
Returns:
Dictionary containing both ‘a11y_tree’ and ‘phone_state’ data