Skip to main content
Glama

index_repository

Index code repositories from GitHub or GitLab to enable search and query capabilities for specific branches.

Instructions

Index a repository to make it searchable for future queries

Input Schema

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

Implementation Reference

  • Main MCP tool handler for index_repository. Extracts arguments, checks client availability, calls GreptileClient.indexRepository, and formats 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), }, ], }; }
  • src/server.ts:102-134 (registration)
    Tool registration in ListToolsRequestSchema handler, including name, description, and input schema.
    { 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'], }, },
  • GreptileClient method that performs the actual HTTP POST request to the Greptile API to index the repository.
    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 index_repository.
    export interface IndexRepositoryInput { remote: string; repository: string; branch: string; reload?: boolean; notify?: boolean; }

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