Skip to main content
Glama

index_repository

Index a GitHub repository to analyze its codebase. This must be done before asking questions about the repository.

Instructions

Index a GitHub repository to analyze its codebase. This must be done before asking questions about the repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_urlYesThe GitHub repository URL to index (format: https://github.com/username/repo).

Implementation Reference

  • The complete handler function for the 'index_repository' tool. It is registered via @mcp.tool() decorator, defines the input schema using Pydantic Field for repo_url, validates the URL, and sends a POST request to the GitHub Chat API's /verify endpoint to index the repository.
    @mcp.tool()
    def index_repository(
        repo_url: str = Field(
            description="The GitHub repository URL to index (format: https://github.com/username/repo)."
        ),
    ) -> str:
        """Index a GitHub repository to analyze its codebase. This must be done before asking questions about the repository."""
        try:
            if not repo_url:
                raise ValueError("Repository URL cannot be empty.")
            
            if not repo_url.startswith("https://github.com/"):
                raise ValueError("Repository URL must be in the format: https://github.com/username/repo")
            
            # Call the verify API endpoint
            response = requests.post(
                f"{GITHUB_CHAT_API_BASE}/verify",
                headers={"Content-Type": "application/json"},
                json={"repo_url": repo_url}
            )
            
            if response.status_code != 200:
                return f"Error indexing repository: {response.text}"
            
            return f"Successfully indexed repository: {repo_url}. You can now ask questions about this repository."
        
        except Exception as e:
            return f"Error: {str(e) or repr(e)}"

Tool Description Quality Score

Score is being calculated. Check back soon.

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/AsyncFuncAI/github-chat-mcp'

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