list_packages
List installed packages on Android devices with optional filtering by name or system status to identify applications for development, testing, or debugging workflows.
Instructions
List installed packages, optionally filtered
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter_text | No | ||
| include_system | No | ||
| device_serial | No |
Implementation Reference
- src/adb_mcp_server/server.py:619-637 (handler)The handler function that implements the logic for the 'list_packages' MCP tool. It executes ADB commands to list installed packages, filters them based on parameters, and returns a sorted list of package names.@mcp.tool() def list_packages( filter_text: str = "", include_system: bool = False, device_serial: str | None = None ) -> list[str]: """List installed packages, optionally filtered""" args = ["shell", "pm", "list", "packages"] if not include_system: args.append("-3") # Third-party only output = run_adb(args, device_serial) packages = [line.replace("package:", "").strip() for line in output.split('\n') if line.strip()] if filter_text: packages = [p for p in packages if filter_text.lower() in p.lower()] return sorted(packages)