get_network_info
Retrieve network connectivity details from Android devices to diagnose connection issues and verify network status during development and testing.
Instructions
Get network connectivity information
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": "get_network_info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_serial | No |
Implementation Reference
- src/adb_mcp_server/server.py:818-834 (handler)The handler function implementing the 'get_network_info' tool. Decorated with @mcp.tool() for automatic registration in the MCP server. Retrieves WiFi status and IP address via ADB shell commands (dumpsys wifi and ip addr), parses the output, and returns a dictionary with wifi_enabled, connected, and optionally ip_address.
@mcp.tool() def get_network_info(device_serial: str | None = None) -> dict: """Get network connectivity information""" wifi = run_adb(["shell", "dumpsys", "wifi"], device_serial) info = { "wifi_enabled": "Wi-Fi is enabled" in wifi, "connected": "CONNECTED" in wifi } # Get IP address ip_output = run_adb(["shell", "ip", "addr", "show", "wlan0"], device_serial) ip_match = re.search(r'inet (\d+\.\d+\.\d+\.\d+)', ip_output) if ip_match: info['ip_address'] = ip_match.group(1) return info