Skip to content

Remove the retrieve_docs MCP tool; keep search_docs + get_doc_content - #15

Merged
tae2089 merged 2 commits into
mainfrom
refactor/remove-retrieve-docs
Jul 11, 2026
Merged

Remove the retrieve_docs MCP tool; keep search_docs + get_doc_content#15
tae2089 merged 2 commits into
mainfrom
refactor/remove-retrieve-docs

Conversation

@tae2089

@tae2089 tae2089 commented Jul 11, 2026

Copy link
Copy Markdown
Owner

What

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. Drop it; callers compose search_docsget_doc_content.

Changes

  • Remove the retrieve_docs MCP tool: handler, DB helper, response DTO aliases, and the retrieve_docs-only doc-content readers (readIndexedDocContent/resolveIndexedDocPath) in 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.

MCP tools 26 → 25. Net −407 lines.

Investigation (why this cut)

retrieval (scoring engine) and ragindex (wiki tree model) are shared by search_docs, retrieve_docs, and the Wiki — so neither can be removed. The only retrieve_docs-unique code was the Explain diagnostics path (FromDBWithOptions, explain fields, ScoreDBFieldBreakdown). search_docs and Wiki both call the non-explain FromDB, so trimming the explain wrapper leaves them untouched.

Review

Independent adversarial review: faithful no-op refactor, no P0/P1/P2. The new FromDB body is the original FromDBWithOptions with opts threaded out and the if opts.Explain branch 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/ScoreDBFieldBreakdown confirmed dead; the 4 explain fields had zero other consumers.

Verification

  • go build + go vet clean; go test -tags fts5 ./... green.
  • Real MCP server: tools/list returns 25 tools; retrieve_docs absent; search_docs and get_doc_content present.

Independent PR off main (parallel to #14 and the pending trim PRs).

🤖 Generated with Claude Code

tae2089 and others added 2 commits July 11, 2026 12:27
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>
@tae2089
tae2089 merged commit c9c0126 into main Jul 11, 2026
1 check failed
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.

1 participant