Skip to main content
Glama

manage_groups

Read-only

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

TableJSON Schema
NameRequiredDescriptionDefault
actionYesOperation to perform
group_nameNoGroup name (required for list_packages_in_group)

Implementation Reference

  • 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}")
  • 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)}
  • 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}
  • 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)
    ),
  • 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))]
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, indicating this is a read-only operation. The description reinforces this by describing listing actions. It adds no additional behavioral details beyond what annotations and schema provide, such as side effects or error states.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, consisting of two sentences plus examples. It front-loads the purpose and directly lists actions. No redundant or unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with two read-only actions and no output schema, the description fully covers the functionality. It explains both actions and their parameter requirements. Sibling tools are diverse but this tool's scope is narrow and well-covered.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so parameters are fully described in the input schema. The description adds value by providing example parameter values and showing the required combination (group_name for list_packages_in_group), but this is a minor addition over the schema's own descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it is a unified group management tool and explicitly lists the two supported actions (list_groups and list_packages_in_group) with examples. It distinguishes itself from sibling tools by focusing specifically on group operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for using each action (list all groups vs. list packages in a specific group) with concrete examples. It does not explicitly mention when not to use this tool or compare directly with alternatives, but the usage is well-implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nihalxkumar/arch-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server