Skip to content

Expose reranker score in MCP/REST explain output - #752

Open
Kyzcreig wants to merge 1 commit into
tobi:mainfrom
Kyzcreig:feat/expose-rerank-score
Open

Expose reranker score in MCP/REST explain output#752
Kyzcreig wants to merge 1 commit into
tobi:mainfrom
Kyzcreig:feat/expose-rerank-score

Conversation

@Kyzcreig

Copy link
Copy Markdown

Summary

  • Adds optional explain: true support to the MCP query tool and HTTP REST /query//search path.
  • Exposes a top-level rerankScore per result when explain output is requested.
  • Keeps default responses unchanged: no explain, no rerankScore unless explain: true is supplied.
  • Maps disabled-rerank sentinel behavior to null instead of exposing 0 as a semantic relevance score.

Why

QMD already computes a pure semantic reranker score inside HybridQueryExplain.rerankScore, but callers at the MCP/HTTP boundary only receive the blended display score. That blended score includes RRF/position signal, so it is useful for ranking but not for applying a semantic relevance floor.

This exposes the existing pure reranker signal without changing the default response shape.

Test plan

  • bun install
  • bun run test:types
  • CI=true bunx vitest run test/mcp.test.ts --reporter=verbose --testTimeout 60000
  • bun run build
  • NODE_NO_WARNINGS=1 bun run test:unit

Note: bun run test:unit without NODE_NO_WARNINGS=1 failed locally only on pre-existing test/cli.test.ts stderr-empty assertions due to Node DEP0205 module.register() deprecation warnings; rerunning with warnings suppressed produced 883 pass / 80 skip / 0 fail.

@Kyzcreig

Kyzcreig commented Aug 6, 2026

Copy link
Copy Markdown
Author

Hi! This PR has been open for about 37 days and hasn't had a look from anyone yet. It's not a draft and currently shows as mergeable, so it should be ready for a first pass whenever someone has a moment.

No decision needed from me right now — just flagging it for visibility so it doesn't keep sitting in the queue. Happy to rebase, split it up, or add more context if that would make reviewing easier. Thanks!

@PowderAddicts

PowderAddicts commented Aug 6, 2026 via email

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants