Skip to main content

app_set

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

Put a checkbox or switch into a state, rather than toggling whatever it is in. Idempotent: asking for a state it is already in does nothing and says so, which is what makes it safe to call without reading first. That is the difference from app_tap — tapping a checkbox flips it, so reaching a known state with tap means read, compare, tap, read again, on every checkbox. Refuses anything with no checked state rather than tapping it and calling it checked, and refuses to uncheck a radio button, which is not a thing a radio does: a group is cleared by choosing a different member. The tap is confirmed by reading the state back, so a control that did not respond is reported rather than assumed. Inside a WebView it reads the page's own state — an input's checked, or aria-checked — and takes a ref from that context's app_map.

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).
targetstringyesA ref from app_map ("@e2") or a locator ("testid=terms").
valuebooleanThe state to put it in: true checked or on, false unchecked or off. Defaults to true.

Examples​

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

Tick a checkbox, whatever state it is in​

{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "app_set",
"arguments": {
"target": "testid=termsCheck"
}
}
}

On an Android 15 emulator the answer's text was:

testid=termsCheck is now checked
BeforeAfter
Before: mobium set testid=termsCheck on an Android 15 emulatorAfter: mobium set testid=termsCheck on an Android 15 emulator

mobium set testid=termsCheck on an Android 15 emulator

Turn a switch off​

{
"target": "@e4",
"value": false
}

On a device​

BeforeAfter
Before: mobium unset testid=termsCheck on an Android 15 emulatorAfter: mobium unset testid=termsCheck on an Android 15 emulator

mobium unset testid=termsCheck on an Android 15 emulator