Skip to main content
Glama
lemenkov
by lemenkov

get_file

Retrieve file content from Pagure repositories by specifying project, filename, branch, and namespace parameters to access specific files.

Instructions

Get file content from a Pagure repository.

Args: project: Project name filename: File path (e.g., 'python3.spec', 'sources') branch: Branch name (default: rawhide) namespace: Project namespace (default: rpms)

Returns: File content as string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYes
filenameYes
branchNorawhide
namespaceNorpms

Implementation Reference

  • The MCP tool registration and handler function for get_file.
    @mcp.tool()
    async def get_file(
        project: str,
        filename: str,
        branch: str = "rawhide",
        namespace: str = "rpms",
    ) -> str:
        """Get file content from a Pagure repository.
    
        Args:
            project: Project name
            filename: File path (e.g., 'python3.spec', 'sources')
            branch: Branch name (default: rawhide)
            namespace: Project namespace (default: rpms)
    
        Returns:
            File content as string
        """
        client = get_client()
        content = await client.get_file(project, filename, branch, namespace)
    
        return content
  • The actual implementation of the get_file logic that performs the HTTP request to the Pagure API.
    async def get_file(
        self,
        project: str,
        filename: str,
        branch: str = "rawhide",
        namespace: str = "rpms",
    ) -> str:
        """Get file content from repository.
    
        Args:
            project: Project name
            filename: File path
            branch: Branch name
            namespace: Project namespace
    
        Returns:
            File content as string
        """
        response = await self.client.get(
            f"{self.base_url}/{namespace}/{project}/raw/{branch}/f/{filename}",
            headers=self._get_headers(),
        )
        response.raise_for_status()
        return response.text

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/lemenkov/mcp-pagure'

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