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)}"
Behavior3/5

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

No annotations are provided, so the description carries full burden. It discloses that indexing is required before querying (a behavioral constraint) but doesn't mention other traits like whether indexing is idempotent, how long it takes, error conditions, or what 'analyze its codebase' entails operationally. The description adds some context but leaves significant behavioral aspects unspecified.

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?

Two sentences with zero waste: the first states the purpose, the second provides crucial usage guidance. Every word earns its place, and the most important information (the prerequisite nature) is front-loaded in the second sentence.

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 complexity (a mutation operation with no annotations and no output schema), the description is reasonably complete for its core purpose and workflow context. It explains why indexing is needed and how it relates to querying, though it could better address behavioral aspects like what 'indexing' actually does or what happens on repeated calls.

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 description coverage is 100% (the single parameter 'repo_url' is fully documented in the schema with format details). The description doesn't add any parameter-specific information beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without compensating value.

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 the specific action ('index') and resource ('GitHub repository') with the purpose 'to analyze its codebase'. It distinguishes from the sibling tool 'query_repository' by explaining this is a prerequisite step before querying.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use this tool ('before asking questions about the repository') and implies an alternative workflow with the sibling tool 'query_repository'. Provides clear context about the prerequisite nature of indexing.

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

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