OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

MCP Tool search_metadata should return _score in result hits

Open kimiiic opened this issue 6 months ago • 1 comments

Is your feature request related to a problem? Please describe.

The search_metadata MCP tool uses OpenSearch under the hood and orders results by _score (relevance), but the score is stripped from the response. Tools that call search_metadata with a queryFilter get correctly-ordered results but cannot see the actual relevance scores — they're all null, This makes it impossible to do composite client-side ranking. For example, blending BM25 text relevance with business signals like tier, owner, or domain assignment.

Describe the solution you'd like

Include _score (or map it as similarityScore) in each hit returned by search_metadata, the same way semantic_search already maps _score → similarityScore in its cleanHit method.

Describe alternatives you've considered

The current workaround is to duplicate the text relevance logic on the client side — embedding multi_match boosts in the queryFilter AND reimplementing the same field-weighting in Python. This is fragile and diverges from OpenSearch's actual BM25 scoring.

Additional context

  • semantic_search already returns similarityScore — this would align search_metadata with that precedent
  • The normalize_results consumer in the Python SDK already reads _score as a fallback: _first_present(item, "similarityScore", "score", "_score")
  • Likely a one-line addition wherever search_metadata builds its hit result map

Pre-submission checklist

  • [x] I searched for duplicate feature requests.

kimiiic avatar May 27 '26 14:05 kimiiic

Hi, I'd like to work on this issue. I have experience with Java and Spring Boot backend development. Can you assign it to me?

srinithreddy16 avatar May 28 '26 17:05 srinithreddy16