Network state control¶
Goal¶
Provide a single MCP tool to toggle Wi-Fi, cellular, and airplane mode, plus emulator-friendly latency/bandwidth shaping.
Proposed MCP tool¶
setNetworkState({
airplaneMode?: boolean,
wifi?: boolean,
cellular?: boolean,
profile?: "edge" | "umts" | "lte" | "full",
delayProfile?: "gprs" | "edge" | "umts" | "none"
})
Semantics:
- Toggles are applied first (airplane, wifi, cellular).
- Profiles are best-effort on emulators only.
- Response includes
supportedandappliedfields per sub-action.
Android implementation¶
Wi-Fi:
adb -s <device> shell svc wifi enableadb -s <device> shell svc wifi disable
Cellular:
adb -s <device> shell svc data enableadb -s <device> shell svc data disable
Airplane mode (preferred, API 29/35 emulators):
adb -s <device> shell cmd connectivity airplane-mode enableadb -s <device> shell cmd connectivity airplane-mode disable
Airplane mode fallback:
adb -s <device> shell settings put global airplane_mode_on 1|0adb -s <device> shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true|false
Emulator shaping (API 29/35 emulator only):
adb -s <device> emu network speed <profile>adb -s <device> emu network delay <profile>
Notes:
- Custom ms/throughput values are not supported by
emu networkand should be rejected with a clear error. - Physical devices often restrict airplane mode toggles; report
supported: falsewith a reason when blocked.
ADB validation (API 35)¶
Status:
- API 29 not validated yet (no local AVD available).
Confirmed commands:
- Wi-Fi toggle:
adb -s <device> shell svc wifi disableadb -s <device> shell settings get global wifi_onadb -s <device> shell svc wifi enableadb -s <device> shell settings get global wifi_on- Cellular data toggle:
adb -s <device> shell svc data disableadb -s <device> shell settings get global mobile_dataadb -s <device> shell svc data enableadb -s <device> shell settings get global mobile_data- Airplane mode:
adb -s <device> shell cmd connectivity airplane-mode enableadb -s <device> shell settings get global airplane_mode_onadb -s <device> shell cmd connectivity airplane-mode disableadb -s <device> shell settings get global airplane_mode_on- Emulator speed/delay profiles:
adb -s <device> emu network speed lteadb -s <device> emu network delay umtsadb -s <device> emu network status
Observed results:
wifi_ontoggles 0/1 aftersvc wifidisable/enable.mobile_datatoggles 0/1 aftersvc datadisable/enable.airplane_mode_ontoggles 1/0 after enable/disable.emu network speed/delayreturn OK andemu network statusreports LTE/UMTS values.
Plan¶
- Implement toggles with capability reporting.
- Add emulator shaping support (speed/delay profiles).
- Expose
getNetworkStatefor verification in assertions.
Risks¶
- OEM images may block
cmd connectivity airplane-mode. - Work profile behavior can differ from personal profile toggles.