OpenMetadata/openmetadata-mcp
Dmitriy 32e355460f
Fixes #22596: MCP SearchMetadataTool "Failed to find index table" error with clusterAlias (#22597)
* ISSUE-22596: Fix search alias resolution with clusterAlias configuration

**Problem:**
MCP SearchMetadataTool was failing with "Failed to find index table" error
in production environments when clusterAlias is configured, while working
correctly in development environments without clusterAlias.

**Root Cause:**
- SearchMetadataTool was directly using entity alias names (e.g., "table")
  without applying the clusterAlias transformation
- When clusterAlias is configured, both search indices and their aliases
  are created with the cluster prefix
- Without this transformation:
  - Development: "table" alias exists 
  - Production: only "openmetadata_table" alias exists, "table" doesn't 

**Solution:**
- Apply SearchRepository.getIndexOrAliasName() transformation to respect clusterAlias
- This ensures the correct alias name is used ("table" → "openmetadata_table" in production)
- Add enhanced logging to track alias name resolution

**Testing:**
- Added unit tests covering scenarios with and without clusterAlias
- Verified fix resolves production issue with clusterAlias="openmetadata"

**Impact:**
- Fixes MCP search functionality in production environments using clusterAlias
- No breaking changes to existing functionality
- Maintains backward compatibility with environments without clusterAlias

Closes #ISSUE-22596

* ISSUE-22596: Clean up SearchMetadataToolTest: remove unused imports and redundant comments

---------

Co-authored-by: dmitrii.cherkashin <dmitrii.cherkashin@welltory.com>
Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com>
Co-authored-by: Mohit Yadav <105265192+mohityadav766@users.noreply.github.com>
2025-07-28 18:53:46 +05:30
..