list_explicit_packages
Identify packages manually installed on Arch Linux systems to create backup lists and understand system composition by distinguishing user-installed packages from automatic dependencies.
Instructions
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 main execution logic for the 'list_explicit_packages' tool. Runs 'pacman -Qe' to list explicitly installed packages, parses the output into name/version pairs, and returns a structured response with package count and list or an appropriate error.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)}" )
- The tool schema definition in @server.list_tools(), including name, description, and empty inputSchema (no parameters required).name="list_explicit_packages", description="[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.", inputSchema={ "type": "object", "properties": {} } ),
- src/arch_ops_server/server.py:1309-1315 (registration)The tool dispatcher registration in @server.call_tool(), which checks Arch Linux availability, calls the handler function, and formats the JSON response.elif name == "list_explicit_packages": if not IS_ARCH: return [TextContent(type="text", text="Error: list_explicit_packages only available on Arch Linux systems")] result = await list_explicit_packages() return [TextContent(type="text", text=json.dumps(result, indent=2))]
- Metadata definition for the tool, categorizing it as maintenance/read operation on Arch, with related tools for marking install reasons."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=[] ),