stop_app
Force stop an Android app by package name to terminate its process. Ideal for testing app behavior under forced termination or clearing app state during security analysis.
Instructions
Force stop an app by package name
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| package | Yes | App package name to stop | |
| device_id | No | Device ID (optional) |
Implementation Reference
- src/frida_mcp/adb.py:89-92 (handler)The actual handler function for stop_app. It executes 'adb shell am force-stop <package>' via subprocess and returns a dict with package, stopped=True, and the command output.
def stop_app(package: str, device_id: str | None = None) -> dict: """Force stop an app.""" output = adb_shell(["am", "force-stop", package], device_id) return {"package": package, "stopped": True, "output": output} - src/frida_mcp/tools.py:99-110 (schema)The tool definition / input schema for stop_app. Defines name, description, and inputSchema requiring 'package' (string) with optional 'device_id' (string).
Tool( name="stop_app", description="Force stop an app by package name", inputSchema={ "type": "object", "properties": { "package": {"type": "string", "description": "App package name to stop"}, "device_id": {"type": "string", "description": "Device ID (optional)"}, }, "required": ["package"], }, ), - src/frida_mcp/server.py:52-53 (registration)The dispatcher registration that routes the 'stop_app' tool name to the adb.stop_app() implementation function.
elif name == "stop_app": return adb.stop_app(arguments["package"], arguments.get("device_id")) - tests/test_helpers.py:179-187 (helper)Test for the stop_app helper/adb function. Verifies it calls 'adb shell am force-stop' with the package and returns stopped=True.
def test_stop_app_calls_force_stop(self): with patch("objection_mcp.server._adb_shell") as mock: mock.return_value = "" from objection_mcp.server import stop_app result = stop_app("com.test.app") mock.assert_called_with(["am", "force-stop", "com.test.app"], None) assert result["stopped"] is True