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; }

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