Skip to main content
Glama

find_package_owner

Identify which Arch Linux package owns a specific file on your system to troubleshoot issues and understand file origins.

Instructions

Find which package owns a specific file on the system. Useful for troubleshooting and understanding file origins. Only works on Arch Linux.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute path to the file (e.g., /usr/bin/vim)

Implementation Reference

  • Core handler implementation: executes 'pacman -Qo' command to query file ownership, parses output, handles errors, and returns structured result with owning package and version.
    async def find_package_owner(file_path: str) -> Dict[str, Any]: """ Find which package owns a specific file. Args: file_path: Absolute path to file Returns: Dict with package owner information """ if not IS_ARCH: return create_error_response( "NotSupported", "Package ownership queries are only available on Arch Linux" ) if not check_command_exists("pacman"): return create_error_response( "CommandNotFound", "pacman command not found" ) logger.info(f"Finding owner of file: {file_path}") try: exit_code, stdout, stderr = await run_command( ["pacman", "-Qo", file_path], timeout=5, check=False ) if exit_code != 0: logger.info(f"No package owns {file_path}") return create_error_response( "NotFound", f"No package owns this file: {file_path}", stderr ) # Parse output: "/path/to/file is owned by package 1.0-1" match = re.search(r'is owned by (\S+)\s+(\S+)', stdout) if match: package_name = match.group(1) version = match.group(2) logger.info(f"File {file_path} is owned by {package_name} {version}") return { "file": file_path, "package": package_name, "version": version } return create_error_response( "ParseError", f"Could not parse pacman output: {stdout}" ) except Exception as e: logger.error(f"Package ownership query failed: {e}") return create_error_response( "CommandError", f"Failed to find package owner: {str(e)}" )
  • MCP tool schema definition: specifies input parameters (file_path string), description, and registers the tool for discovery via list_tools().
    name="find_package_owner", description="[ORGANIZATION] Find which package owns a specific file on the system. Useful for troubleshooting and understanding file origins. Only works on Arch Linux.", inputSchema={ "type": "object", "properties": { "file_path": { "type": "string", "description": "Absolute path to the file (e.g., /usr/bin/vim)" } }, "required": ["file_path"] } ),
  • Tool dispatch/registration in call_tool(): validates platform, extracts arguments, invokes handler, and serializes response as JSON.
    elif name == "find_package_owner": if not IS_ARCH: return [TextContent(type="text", text="Error: find_package_owner only available on Arch Linux systems")] file_path = arguments["file_path"] result = await find_package_owner(file_path) return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • Tool metadata: categorizes as organization/debug workflow, Arch-only read operation, links to related tools for file/package analysis.
    "find_package_owner": ToolMetadata( name="find_package_owner", category="organization", platform="arch", permission="read", workflow="debug", related_tools=["list_package_files", "verify_package_integrity"], prerequisite_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