list_explicit_packages
Identify user-installed packages on Arch Linux to create backup lists or analyze system composition by filtering out dependency-installed packages.
Instructions
[MAINTENANCE] List all packages explicitly installed by the user (not installed as dependencies). Useful for creating backup lists or understanding system composition. Only works on Arch Linux.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/arch_ops_server/pacman.py:1048-1105 (handler)The core handler function that lists explicitly installed packages by running 'pacman -Qe', parsing the output into name-version dicts, with Arch-only support and error handling.async def list_explicit_packages() -> Dict[str, Any]: """ List explicitly installed packages. Returns: Dict with list of explicit packages """ if not IS_ARCH: return create_error_response( "NotSupported", "Package install reason queries are only available on Arch Linux" ) if not check_command_exists("pacman"): return create_error_response( "CommandNotFound", "pacman command not found" ) logger.info("Listing explicitly installed packages") try: exit_code, stdout, stderr = await run_command( ["pacman", "-Qe"], timeout=15, check=False ) if exit_code != 0: return create_error_response( "CommandError", f"Failed to list explicit packages: {stderr}" ) # Parse output - format: "package version" packages = [] for line in stdout.strip().split('\n'): if line.strip(): parts = line.split() if len(parts) >= 2: packages.append({ "name": parts[0], "version": parts[1] }) logger.info(f"Found {len(packages)} explicitly installed packages") return { "package_count": len(packages), "packages": packages } except Exception as e: logger.error(f"Failed to list explicit packages: {e}") return create_error_response( "CommandError", f"Failed to list explicit packages: {str(e)}" )
- src/arch_ops_server/__init__.py:21-38 (registration)Re-exports list_explicit_packages from pacman.py as part of the package namespace, making it available for MCP tool registration.from .pacman import ( get_official_package_info, check_updates_dry_run, remove_package, remove_packages_batch, list_orphan_packages, remove_orphans, find_package_owner, list_package_files, search_package_files, verify_package_integrity, list_package_groups, list_group_packages, list_explicit_packages, mark_as_explicit, mark_as_dependency, check_database_freshness )
- Metadata defining the tool's category (maintenance), platform (arch), permission (read), workflow (audit), and related tools."list_explicit_packages": ToolMetadata( name="list_explicit_packages", category="maintenance", platform="arch", permission="read", workflow="audit", related_tools=["mark_as_explicit", "mark_as_dependency"], prerequisite_tools=[]