send_sms
Send SMS messages to Android emulators for testing communication features during development and QA workflows.
Instructions
Send an SMS to the emulator (emulator only)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| phone_number | Yes | ||
| message | Yes | ||
| device_serial | No |
Implementation Reference
- src/adb_mcp_server/server.py:1117-1126 (handler)The primary handler for the send_sms tool. Decorated with @mcp.tool() for automatic registration and schema inference from type hints. Executes the ADB emulator SMS send command via the run_adb helper.@mcp.tool() def send_sms( phone_number: str, message: str, device_serial: str | None = None ) -> str: """Send an SMS to the emulator (emulator only)""" return run_adb([ "emu", "sms", "send", phone_number, message ], device_serial)
- src/adb_mcp_server/server.py:24-39 (helper)Core utility helper function that runs ADB commands using subprocess, handles device serial, timeouts, and errors. Directly used by the send_sms handler to execute the 'adb emu sms send' command.def run_adb(args: list[str], device_serial: str | None = None, timeout: int = 30) -> str: """Run an ADB command and return output""" cmd = ["adb"] if device_serial: cmd.extend(["-s", device_serial]) cmd.extend(args) try: result = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout) if result.returncode != 0 and result.stderr: return f"Error: {result.stderr}" return result.stdout except subprocess.TimeoutExpired: return "Error: Command timed out" except Exception as e: return f"Error: {str(e)}"