verify_package_integrity
Check installed package files on Arch Linux for modifications, missing files, or corruption to maintain system integrity.
Instructions
[MAINTENANCE] Verify the integrity of installed package files. Detects modified, missing, or corrupted files. Only works on Arch Linux.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| package_name | Yes | Name of the package to verify | |
| thorough | No | Perform thorough check including file attributes. Default: false |
Implementation Reference
- src/arch_ops_server/pacman.py:864-925 (handler)The core handler function that executes the package integrity verification using pacman -Qk or -Qkk, parses output for issues, and returns structured results.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)}" )
- Defines the input schema and description for the verify_package_integrity tool in the MCP server list_tools().name="verify_package_integrity", description="[MAINTENANCE] Verify the integrity of installed package files. Detects modified, missing, or corrupted files. Only works on Arch Linux.", 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"] } ),
- src/arch_ops_server/server.py:1283-1291 (registration)Registers the tool handler call in the MCP server's call_tool() dispatcher, extracting arguments and invoking the verify_package_integrity function.elif name == "verify_package_integrity": if not IS_ARCH: return [TextContent(type="text", text="Error: verify_package_integrity only available on Arch Linux systems")] 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))]
- Provides metadata for the verify_package_integrity tool including category, platform, permissions, and related tools."verify_package_integrity": ToolMetadata( name="verify_package_integrity", category="maintenance", platform="arch", permission="read", workflow="verify", related_tools=["get_transaction_history", "find_package_owner"], prerequisite_tools=[] ),