toggle_airplane_mode
Enable or disable airplane mode on Android devices to manage network connectivity during development, testing, and debugging workflows.
Instructions
Enable or disable airplane mode
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": {
"enable": "<enable>"
},
"name": "toggle_airplane_mode"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| enable | Yes | ||
| device_serial | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/adb_mcp_server/server.py:844-852 (handler)The handler function for toggle_airplane_mode tool, decorated with @mcp.tool() for automatic registration in MCP. Executes ADB commands to set airplane_mode_on global setting and broadcasts the AIRPLANE_MODE intent.
@mcp.tool() def toggle_airplane_mode(enable: bool, device_serial: str | None = None) -> str: """Enable or disable airplane mode""" value = "1" if enable else "0" run_adb(["shell", "settings", "put", "global", "airplane_mode_on", value], device_serial) # Broadcast the change intent = "android.intent.action.AIRPLANE_MODE" run_adb(["shell", "am", "broadcast", "-a", intent], device_serial) return f"Airplane mode {'enabled' if enable else 'disabled'}"