Skip to main content
Glama

verify_package_integrity

Read-only

Check if installed package files have been modified, missing, or corrupted. Use after system crashes or disk errors to verify package integrity on Arch Linux.

Instructions

[MAINTENANCE] Verify the integrity of installed package files. Detects modified, missing, or corrupted files. Only works on Arch Linux. When to use: After system crash or disk errors, verify 'linux' package files match expected checksums.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
package_nameYesName of the package to verify
thoroughNoPerform thorough check including file attributes. Default: false

Implementation Reference

  • The core implementation of verify_package_integrity. Runs `pacman -Qkk` (thorough) or `pacman -Qk` (standard) to verify installed package files, parses warnings/missing files, and returns results with issues count.
    async def verify_package_integrity(package_name: str, thorough: bool = False) -> Dict[str, Any]:
        """
        Verify integrity of an installed package.
    
        Args:
            package_name: Name of package to verify
            thorough: If True, perform thorough check (pacman -Qkk)
    
        Returns:
            Dict with verification results
        """
        if not IS_ARCH:
            return create_error_response(
                "NotSupported",
                "Package verification is only available on Arch Linux"
            )
    
        if not check_command_exists("pacman"):
            return create_error_response(
                "CommandNotFound",
                "pacman command not found"
            )
    
        logger.info(f"Verifying package integrity: {package_name} (thorough={thorough})")
    
        try:
            cmd = ["pacman", "-Qkk" if thorough else "-Qk", package_name]
    
            exit_code, stdout, stderr = await run_command(
                cmd,
                timeout=30,
                check=False
            )
    
            if exit_code != 0 and "was not found" in stderr:
                return create_error_response(
                    "NotFound",
                    f"Package not installed: {package_name}"
                )
    
            # Parse verification output
            issues = []
            for line in stdout.strip().split('\n'):
                if "warning" in line.lower() or "missing" in line.lower():
                    issues.append(line.strip())
    
            logger.info(f"Found {len(issues)} issues for {package_name}")
    
            return {
                "package": package_name,
                "thorough": thorough,
                "issues_found": len(issues),
                "issues": issues,
                "all_ok": len(issues) == 0
            }
    
        except Exception as e:
            logger.error(f"Package verification failed: {e}")
            return create_error_response(
                "CommandError",
                f"Failed to verify package: {str(e)}"
            )
  • Tool registration with input schema (package_name required, thorough optional) and description for the verify_package_integrity tool.
    Tool(
        name="verify_package_integrity",
        description="[MAINTENANCE] Verify the integrity of installed package files. Detects modified, missing, or corrupted files. Only works on Arch Linux. When to use: After system crash or disk errors, verify 'linux' package files match expected checksums.",
        inputSchema={
            "type": "object",
            "properties": {
                "package_name": {
                    "type": "string",
                    "description": "Name of the package to verify"
                },
                "thorough": {
                    "type": "boolean",
                    "description": "Perform thorough check including file attributes. Default: false",
                    "default": False
                }
            },
            "required": ["package_name"]
        },
        annotations=ToolAnnotations(readOnlyHint=True)
    ),
  • The call_tool dispatcher that routes 'verify_package_integrity' invocations to the actual handler function, including platform check for Arch Linux.
    elif name == "verify_package_integrity":
        if not IS_ARCH:
            return [TextContent(type="text", text=create_platform_error_message("verify_package_integrity"))]
    
        package_name = arguments["package_name"]
        thorough = arguments.get("thorough", False)
        result = await verify_package_integrity(package_name, thorough)
        return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • Import of verify_package_integrity from pacman module into the package namespace.
    from .pacman import (
        get_official_package_info,
        check_updates_dry_run,
        remove_package,
        remove_packages_batch,
        remove_packages,
        list_orphan_packages,
        remove_orphans,
        manage_orphans,
        find_package_owner,
        list_package_files,
        search_package_files,
        query_file_ownership,
        verify_package_integrity,
        list_explicit_packages,
        mark_as_explicit,
        mark_as_dependency,
        manage_install_reason,
        check_database_freshness,
    )
  • ToolMetadata definition for verify_package_integrity (category: maintenance, platform: arch, permission: read, workflow: verify) with related tools.
    "verify_package_integrity": ToolMetadata(
        name="verify_package_integrity",
        category="maintenance",
        platform="arch",
        permission="read",
        workflow="verify",
        related_tools=["query_package_history", "query_file_ownership"],
        prerequisite_tools=[]
    ),
Behavior4/5

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

Annotations already indicate readOnlyHint=true, but the description adds behavioral context: it detects modified/missing/corrupted files and only works on Arch Linux. No contradictions.

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 very concise with a front-loaded '[MAINTENANCE]' tag, clear verb, and a separate usage line. Every sentence adds value.

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

Completeness4/5

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

Given the tool's simplicity (2 params, no output schema), the description adequately covers purpose and usage scenario. It could mention what happens on failure, but the core is clear.

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 covers 100% of parameters with descriptions. The description adds no additional meaning beyond what is already in the schema, so baseline 3 is appropriate.

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 'Verify the integrity of installed package files' with specific detection of modified/missing/corrupted files and a platform constraint (Arch Linux). This distinguishes it from sibling tools like audit_package_security, which likely focuses on security advisories.

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 explicit 'When to use' guidance: after system crash or disk errors. It does not explicitly mention when not to use or compare to alternatives, but the context is clear.

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