press_key
Send key events to Android devices by specifying keycode integers like BACK=4 or ENTER=66, enabling programmatic control through ADB connections.
Instructions
A key event sent to the Android device using the given keycode integer.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"keycode": "<keycode>"
},
"name": "press_key"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keycode | Yes | Android keycode integer. Common: BACK=4, HOME=3, ENTER=66, RECENTS=187, TAB=61, DEL=67. | |
| device_serial | No | Android device serial (e.g. 'emulator-5554' or '192.168.1.10:5555'). Omit only when a single device is connected. If the tool returns a multi-device error: STOP. Present the device list to the user verbatim and wait for their explicit choice. Do NOT retry with a guessed or inferred serial — this is a hard requirement. Once the user provides a serial, use it for every subsequent call in this session. To switch devices mid-session, ask the user first. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |