manage_groups
List all available package groups or display packages within a specific group.
Instructions
[ORGANIZATION] Unified group management tool. Actions: list_groups (all groups), list_packages_in_group (packages in specific group). Examples: manage_groups(action='list_groups'), manage_groups(action='list_packages_in_group', group_name='base-devel')
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Operation to perform | |
| group_name | No | Group name (required for list_packages_in_group) |
Implementation Reference
- src/arch_ops_server/groups.py:8-23 (handler)Main handler function for 'manage_groups' tool. Dispatches to _list_groups() or _list_packages_in_group() based on action parameter.
async def manage_groups( action: Literal["list_groups", "list_packages_in_group"], group_name: Optional[str] = None ) -> dict: """Unified group management tool.""" if not IS_ARCH: return create_error_response("Requires Arch Linux", error_type="platform_error") if action == "list_groups": return await _list_groups() elif action == "list_packages_in_group": if not group_name: return create_error_response("group_name required", error_type="validation_error") return await _list_packages_in_group(group_name) else: return create_error_response(f"Unknown action: {action}") - src/arch_ops_server/groups.py:26-31 (helper)Helper function that runs 'pacman -Sg' to list all package groups and returns sorted list.
async def _list_groups() -> dict: exit_code, stdout, stderr = await run_command(["pacman", "-Sg"], timeout=10) if exit_code != 0: return create_error_response(f"Failed to list groups: {stderr}") groups = [line.strip() for line in stdout.strip().split("\n") if line.strip()] return {"action": "list_groups", "total_groups": len(groups), "groups": sorted(groups)} - src/arch_ops_server/groups.py:34-44 (helper)Helper function that runs 'pacman -Sg <group_name>' to list packages in a specific group.
async def _list_packages_in_group(group_name: str) -> dict: exit_code, stdout, stderr = await run_command(["pacman", "-Sg", group_name], timeout=10) if exit_code != 0: return create_error_response(f"Failed: {stderr}") packages = [] for line in stdout.strip().split("\n"): if line.strip(): parts = line.split() if len(parts) >= 2: packages.append(parts[1]) return {"action": "list_packages_in_group", "group": group_name, "total_packages": len(packages), "packages": packages} - src/arch_ops_server/server.py:850-870 (registration)Tool registration for 'manage_groups' in list_tools() - defines name, description, and input schema.
# Package Groups Tool( name="manage_groups", description="[ORGANIZATION] Unified group management tool. Actions: list_groups (all groups), list_packages_in_group (packages in specific group). Examples: manage_groups(action='list_groups'), manage_groups(action='list_packages_in_group', group_name='base-devel')", inputSchema={ "type": "object", "properties": { "action": { "type": "string", "enum": ["list_groups", "list_packages_in_group"], "description": "Operation to perform" }, "group_name": { "type": "string", "description": "Group name (required for list_packages_in_group)" } }, "required": ["action"] }, annotations=ToolAnnotations(readOnlyHint=True) ), - src/arch_ops_server/server.py:1186-1194 (handler)call_tool handler for 'manage_groups' - extracts action/group_name from arguments and calls the function.
# Package Groups elif name == "manage_groups": if not IS_ARCH: return [TextContent(type="text", text=create_platform_error_message("manage_groups"))] action = arguments["action"] group_name = arguments.get("group_name", None) result = await manage_groups(action, group_name) return [TextContent(type="text", text=json.dumps(result, indent=2))]