Skip to content

Feature: Allow custom collection name (use folder name instead of hash) #299

@kid1995

Description

@kid1995

Problem

Currently, getCollectionName() in context.js generates collection names as code_chunks_<md5-hash> based on the absolute path:

getCollectionName(codebasePath) {
    const normalizedPath = path.resolve(codebasePath);
    const hash = crypto.createHash('md5').update(normalizedPath).digest('hex');
    const prefix = isHybrid ? 'hybrid_code_chunks' : 'code_chunks';
    return `${prefix}_${hash.substring(0, 8)}`;
}

This makes it impossible to identify which collection belongs to which project in the Zilliz Cloud console. For example, code_chunks_a1b2c3d4 gives no indication that it's the sda-service project.

Proposed Solution

Allow users to configure a human-readable collection name, falling back to the current hash-based naming. Options:

  1. Use the folder name by default: code_chunks_sda_service instead of code_chunks_a1b2c3d4
  2. Add an env var like COLLECTION_NAME_STRATEGY=folder|hash (default: folder)
  3. Add a parameter to index_codebase tool: collectionName (optional)

Using the folder basename (path.basename(codebasePath)) would make collection management much more intuitive in the Zilliz Cloud console, especially when managing multiple indexed codebases.

Environment

  • @zilliz/claude-context-mcp via npx
  • Zilliz Cloud Serverless (AWS eu-central-1)
  • Gemini embeddings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions