Get foreground app
foregroundReturn which app currently has focus on an Android device as a package/activity string, so you can confirm the open app before reading or tapping.
Instructions
Return which app has focus on the device, as a "package/activity" string such as "org.mozilla.firefox/.App". Use it to confirm which app is open before reading or tapping; use snapshot instead to see what is on screen. Read-only. Fails if the device is not connected and authorized, the serial is out of scope, or Android exposes no focused window (for example while the screen is locked).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "foreground"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serial | No | ADB serial of the target device, as returned by list_devices. Required when the server has no --device scope; when scoped, omit it or pass the same serial (any other serial is rejected). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |