Skip to main content

app_eval

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Run a JavaScript expression in the current WebView and return its value as a string. Needs a WebView context — switch with app_context first. Objects come back as JSON. This is the escape hatch for anything app_map and app_text do not cover, and the way to ask a page a question directly rather than inferring the answer from what is on screen.

Changes the device, the app or the session: readOnlyHint is false.

Arguments​

NameTypeRequiredWhat it is
devicestringDevice serial to target, e.g. "emulator-5554". Omit when only one device is running.
driverstring: uiautomator2, uiautomator, wdaDriver to use: "uiautomator2" (default for Android; fast, installs a server APK on first use), "uiautomator" (Android, installs nothing, slower, cannot type), or "wda" (WebDriverAgent: iOS simulators and iPhones).
expressionstringyesA JavaScript expression, e.g. "document.title".

Examples​

Each is the arguments of a tools/call request; the first is shown whole.

Read the page title in a WebView​

{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "app_eval",
"arguments": {
"expression": "document.title"
}
}
}

On a device​

mobium eval document.title on an Android 15 emulator

mobium eval document.title on an Android 15 emulator