Skip to main content
Glama

index_repository

Index a repository to enable searchable queries across its codebase, making it accessible for future analysis and information retrieval.

Instructions

Index a repository to make it searchable for future queries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
remoteYesRepository host (github or gitlab)
repositoryYesRepository in owner/repo format
branchYesBranch to index
reloadNoForce reprocessing of previously indexed repository
notifyNoSend email notification when indexing completes

Implementation Reference

  • Main handler function that executes the index_repository tool logic, checks for Greptile client availability, parses arguments, calls the client method, and formats the response.
    private async handleIndexRepository(
      args: unknown
    ): Promise<{ content: Array<{ type: string; text: string }> }> {
      if (!this.greptileClient) {
        return {
          content: [
            {
              type: 'text',
              text: createErrorResponse(
                'Cannot index repository: Missing environment variables. Use greptile_env_check for setup guidance.',
                'Configuration Error',
                undefined
              ),
            },
          ],
        };
      }
    
      const { remote, repository, branch, reload = true, notify = false } = args as any;
    
      const result = await this.greptileClient.indexRepository(
        remote,
        repository,
        branch,
        reload,
        notify
      );
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • JSON schema definition for the index_repository tool input, including properties, descriptions, defaults, and required fields.
    {
      name: 'index_repository',
      description: 'Index a repository to make it searchable for future queries',
      inputSchema: {
        type: 'object',
        properties: {
          remote: {
            type: 'string',
            enum: ['github', 'gitlab'],
            description: 'Repository host (github or gitlab)',
          },
          repository: {
            type: 'string',
            description: 'Repository in owner/repo format',
          },
          branch: {
            type: 'string',
            description: 'Branch to index',
          },
          reload: {
            type: 'boolean',
            description: 'Force reprocessing of previously indexed repository',
            default: true,
          },
          notify: {
            type: 'boolean',
            description: 'Send email notification when indexing completes',
            default: false,
          },
        },
        required: ['remote', 'repository', 'branch'],
      },
    },
  • src/server.ts:231-232 (registration)
    Tool dispatch registration in the CallToolRequestSchema handler switch statement.
    case 'index_repository':
      return await this.handleIndexRepository(request.params.arguments);
  • GreptileClient helper method that performs the actual API request to index the repository.
     * Index a repository for code search and querying
     */
    async indexRepository(
      remote: string,
      repository: string,
      branch: string,
      reload: boolean = true,
      notify: boolean = false,
      timeout?: number
    ): Promise<Record<string, unknown>> {
      const url = `${this.baseUrl}/repositories`;
      const payload = {
        remote,
        repository,
        branch,
        reload,
        notify,
      };
    
      return this.makeRequest('POST', url, payload, timeout);
    }
  • TypeScript interface defining the input structure for the index_repository tool.
    export interface IndexRepositoryInput {
      remote: string;
      repository: string;
      branch: string;
      reload?: boolean;
      notify?: boolean;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers limited behavioral insight. It mentions the outcome ('make it searchable') but omits critical details: whether indexing is idempotent, time-consuming, or requires specific permissions; what 'searchable' entails (e.g., content types indexed); or side effects like notifications. The 'reload' and 'notify' parameters hint at reprocessing and notifications, but the description doesn't explain these behaviors.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('index a repository') and purpose ('make it searchable'). It avoids redundancy and waste, though it could be slightly more informative without losing conciseness. Structure is clear but minimal.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a mutation tool (indexing implies write operation), the description is incomplete. It lacks details on behavioral traits (e.g., idempotency, performance), output format, error handling, or dependencies. For a 5-parameter tool that modifies state, more context is needed to guide safe and effective use.

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%, so the schema fully documents all 5 parameters (remote, repository, branch, reload, notify). The description adds no parameter-specific information beyond implying indexing scope, but doesn't detail how parameters interact (e.g., 'reload' vs. initial indexing). Baseline is 3 since the schema handles parameter documentation adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('index') and resource ('repository') with a specific purpose ('to make it searchable for future queries'). It distinguishes from siblings like 'get_repository_info' (read-only info) and 'query_repository' (search after indexing), though it doesn't explicitly name alternatives. The purpose is specific but could be more precise about what 'indexing' entails.

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

Usage Guidelines2/5

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

The description provides minimal guidance, stating the tool makes repositories searchable for future queries, which implies it should be used before querying. However, it lacks explicit when-to-use rules (e.g., prerequisites, timing), when-not-to-use scenarios (e.g., if already indexed), or named alternatives like 'reload' parameter for reprocessing. No sibling tools are referenced for comparison.

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/sosacrazy126/greptile-mcp'

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