list_package_groups
Display all available package groups on Arch Linux systems to help users identify and select software collections for installation or management.
Instructions
List all available package groups (e.g., base, base-devel, gnome). Only works on Arch Linux.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/arch_ops_server/pacman.py:928-985 (handler)The main handler function that executes the tool logic by running 'pacman -Sg', parsing the output to extract unique package group names, and returning a structured dictionary with group count and sorted list.async def list_package_groups() -> Dict[str, Any]: """ List all available package groups. Returns: Dict with list of groups """ if not IS_ARCH: return create_error_response( "NotSupported", "Package groups are only available on Arch Linux" ) if not check_command_exists("pacman"): return create_error_response( "CommandNotFound", "pacman command not found" ) logger.info("Listing package groups") try: exit_code, stdout, stderr = await run_command( ["pacman", "-Sg"], timeout=10, check=False ) if exit_code != 0: return create_error_response( "CommandError", f"Failed to list groups: {stderr}" ) # Parse output - format: "group package" groups = set() for line in stdout.strip().split('\n'): if line.strip(): parts = line.split() if parts: groups.add(parts[0]) groups_list = sorted(list(groups)) logger.info(f"Found {len(groups_list)} package groups") return { "group_count": len(groups_list), "groups": groups_list } except Exception as e: logger.error(f"Failed to list groups: {e}") return create_error_response( "CommandError", f"Failed to list package groups: {str(e)}" )
- src/arch_ops_server/server.py:832-838 (registration)MCP tool registration in list_tools(): defines the tool name, description, and input schema (no parameters required).name="list_package_groups", description="[ORGANIZATION] List all available package groups (e.g., base, base-devel, gnome). Only works on Arch Linux.", inputSchema={ "type": "object", "properties": {} } ),
- src/arch_ops_server/server.py:1293-1298 (registration)Tool dispatch logic in call_tool(): checks platform and calls the list_package_groups handler, returning JSON-formatted result.elif name == "list_package_groups": if not IS_ARCH: return [TextContent(type="text", text="Error: list_package_groups only available on Arch Linux systems")] result = await list_package_groups() return [TextContent(type="text", text=json.dumps(result, indent=2))]
- ToolMetadata schema defining categorization (organization), platform requirements (arch), permissions (read), workflow (explore), and relationships to other tools."list_package_groups": ToolMetadata( name="list_package_groups", category="organization", platform="arch", permission="read", workflow="explore", related_tools=["list_group_packages"], prerequisite_tools=[] ),