Skip to main content
Glama

get_official_package_info

Read-only

Retrieve detailed information about official Arch Linux repository packages, including version, dependencies, and install size. Uses local pacman or API fallback.

Instructions

[DISCOVERY] Get information about an official Arch repository package (Core, Extra, etc.). Uses local pacman if available, otherwise queries archlinux.org API. Always prefer official packages over AUR when available. Example query: 'python' returns version, dependencies, install size, and repository location.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
package_nameYesExact package name

Implementation Reference

  • The main async handler function for get_official_package_info. Uses hybrid approach: tries local pacman -Si on Arch Linux first, then falls back to querying archlinux.org API.
    async def get_official_package_info(package_name: str) -> Dict[str, Any]:
        """
        Get information about an official repository package.
        
        Uses hybrid approach:
        - If on Arch Linux: Execute `pacman -Si` for local database query
        - Otherwise: Query archlinux.org API
        
        Args:
            package_name: Package name
        
        Returns:
            Dict with package information
        """
        logger.info(f"Fetching info for official package: {package_name}")
        
        # Try local pacman first if on Arch
        if IS_ARCH and check_command_exists("pacman"):
            info = await _get_package_info_local(package_name)
            if info is not None:
                return info
            logger.warning(f"Local pacman query failed for {package_name}, trying remote API")
        
        # Fallback to remote API
        return await _get_package_info_remote(package_name)
  • Tool registration/dispatch in call_tool() - routes incoming 'get_official_package_info' calls to the handler function.
    elif name == "get_official_package_info":
        package_name = arguments["package_name"]
        result = await get_official_package_info(package_name)
        return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • Tool definition with input schema requiring 'package_name' (string). Registered as a [DISCOVERY] read-only tool.
    Tool(
        name="get_official_package_info",
        description="[DISCOVERY] Get information about an official Arch repository package (Core, Extra, etc.). Uses local pacman if available, otherwise queries archlinux.org API. Always prefer official packages over AUR when available. Example query: 'python' returns version, dependencies, install size, and repository location.",
        inputSchema={
            "type": "object",
            "properties": {
                "package_name": {
                    "type": "string",
                    "description": "Exact package name"
                }
            },
            "required": ["package_name"]
        },
        annotations=ToolAnnotations(readOnlyHint=True)
    ),
  • ToolMetadata definition for get_official_package_info: discovery category, any platform, read permission, research workflow, related to search_aur and install_package_secure.
    "get_official_package_info": ToolMetadata(
        name="get_official_package_info",
        category="discovery",
        platform="any",
        permission="read",
        workflow="research",
        related_tools=["search_aur", "install_package_secure"],
        prerequisite_tools=[]
    ),
  • Private helper _get_package_info_local - runs pacman -Si and parses output locally on Arch Linux systems.
    async def _get_package_info_local(package_name: str) -> Optional[Dict[str, Any]]:
        """
        Query package info using local pacman command.
        
        Args:
            package_name: Package name
        
        Returns:
            Package info dict or None if failed
        """
        try:
            exit_code, stdout, stderr = await run_command(
                ["pacman", "-Si", package_name],
                timeout=5,
                check=False
            )
            
            if exit_code != 0:
                logger.debug(f"pacman -Si failed for {package_name}")
                return None
            
            # Parse pacman output
            info = _parse_pacman_output(stdout)
            
            if info:
                info["source"] = "local"
                logger.info(f"Successfully fetched {package_name} info locally")
                return info
            
            return None
            
        except Exception as e:
            logger.warning(f"Local pacman query failed: {e}")
            return None
Behavior4/5

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

Annotations indicate readOnlyHint, which the description complements by detailing data sources and example output fields (version, dependencies, etc.). No contradictions; adds behavioral context beyond annotations.

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 concise with a single clear sentence plus a helpful example. It is front-loaded with the purpose tag and every sentence adds value.

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 single-parameter tool with no output schema, the description covers all necessary aspects: purpose, usage guidance, data sources, and an example. No gaps.

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

Parameters4/5

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

Schema coverage is 100% with the exact package name described. The description adds a concrete example ('python'), improving usability beyond the schema alone.

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 the tool retrieves information about official Arch repository packages, distinguishing it from AUR-related tools. The example and mention of 'Core, Extra, etc.' clarify the resource scope.

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?

Explicitly advises preferring official packages over AUR, providing clear usage context. It also describes fallback behavior (local pacman vs. API), though it doesn't list specific conditions to avoid this tool.

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