app_hook
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Call a hook the app registered with Mobium's gray-box library, by name, and return what it answered — sign in, seed data, raise a toast: state set up without walking the UI. Needs the app launched with gray_box. The call is written into a field the library adds only in a gray-box launch and the answer read from the device log; it waits for the app to be idle first, and a hook's own work counts as busy. On iOS the call is typed, about 16 ms a character. An unknown name is refused, naming the hooks the app registered; a hook that throws is reported with its message.
Changes the device, the app or the session: readOnlyHint is false.
Arguments
| Name | Type | Required | What it is |
|---|---|---|---|
args | array of string | Arguments for the hook, as strings, in order | |
device | string | Device serial to target, e.g. "emulator-5554". Omit when only one device is running. | |
driver | string: uiautomator2, uiautomator, wda | Driver 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). | |
hook | string | yes | The hook's name, as the app registered it ("signIn") |
timeout_ms | integer | How long to wait for the app's answer (default 15000) |
Examples
Each is the arguments of a tools/call request; the first is shown whole.
Call a hook the app registered, and get back what it answered
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "app_hook",
"arguments": {
"hook": "raiseToast",
"args": [
"Toast raised by test script"
]
}
}
}
On an Android 15 emulator the answer's text was:
hook raiseToast answered: "shown"
gray box: the app was idle

mobium hook raiseToast "Toast raised by test script" on MobiumApp, Android 15 emulator, launched with --gray-box: the app's own toast says what the hook was sent