Remove the retrieve_docs MCP tool; keep search_docs + get_doc_content - #15
Merged
Conversation
retrieve_docs was search_docs (find relevant docs) + get_doc_content (read one)
composed into a single call, plus opt-in scoring "explain" diagnostics agents
rarely use. It overlapped the core doc-search surface, so drop it and let
callers compose search_docs -> get_doc_content.
- remove the retrieve_docs MCP tool: handler, DB helper, response DTO aliases,
and the retrieve_docs-only doc-content readers (readIndexedDocContent /
resolveIndexedDocPath) in internal/mcp/handler_docs.go; registration in
tools_docs.go
- collapse the shared retrieval engine now that the explain path is gone:
FromDBWithOptions folds into FromDB, BuildDBResultWithOptions into
BuildDBResult; delete the Options{Explain} type and the dead MatchedFields /
ScoreDBFieldBreakdown helpers
- drop the four explain-only fields (field_scores, literal_score,
expanded_terms, expansion_score) from ragindex.RetrieveResult
- sweep docs/skills to route doc retrieval through search_docs + get_doc_content
search_docs, get_doc_content, the retrieval scoring core, ragindex, and the Wiki
are unchanged — they only ever used the non-explain path, so their behavior is
byte-identical (independently reviewed). MCP tools 26 -> 25.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
retrieve_docswassearch_docs(find relevant docs) +get_doc_content(read one) composed into a single call, plus opt-in scoring explain diagnostics agents rarely use. It overlapped the core doc-search surface. Drop it; callers composesearch_docs→get_doc_content.Changes
retrieve_docsMCP tool: handler, DB helper, response DTO aliases, and the retrieve_docs-only doc-content readers (readIndexedDocContent/resolveIndexedDocPath) inhandler_docs.go; registration intools_docs.go.FromDBWithOptionsfolds intoFromDB,BuildDBResultWithOptionsintoBuildDBResult; delete theOptions{Explain}type and the deadMatchedFields/ScoreDBFieldBreakdownhelpers.field_scores,literal_score,expanded_terms,expansion_score) fromragindex.RetrieveResult.search_docs+get_doc_content.MCP tools 26 → 25. Net −407 lines.
Investigation (why this cut)
retrieval(scoring engine) andragindex(wiki tree model) are shared bysearch_docs,retrieve_docs, and the Wiki — so neither can be removed. The only retrieve_docs-unique code was theExplaindiagnostics path (FromDBWithOptions, explain fields,ScoreDBFieldBreakdown).search_docsand Wiki both call the non-explainFromDB, so trimming the explain wrapper leaves them untouched.Review
Independent adversarial review: faithful no-op refactor, no P0/P1/P2. The new
FromDBbody is the originalFromDBWithOptionswithoptsthreaded out and theif opts.Explainbranch removed (that branch only set omitempty fields); every other step (candidate search, scan supplement, grouping, annotation batch, sorting, bounded content read) is byte-identical.MatchedFields/ScoreDBFieldBreakdownconfirmed dead; the 4 explain fields had zero other consumers.Verification
go build+go vetclean;go test -tags fts5 ./...green.tools/listreturns 25 tools;retrieve_docsabsent;search_docsandget_doc_contentpresent.Independent PR off
main(parallel to #14 and the pending trim PRs).🤖 Generated with Claude Code