feat: type-level BM25 search corpus and search_types() - #8
Open
jakerobinson wants to merge 2 commits into
Open
Conversation
Introduces mcp_types_bm25_corpus.json (1562 reachable types, 1.3MB) built by a new build_types_bm25_corpus() indexer step. Tokens aggregate type-name and field-name camelCase splits (with org/vm synonym expansion), first-8-word field descriptions, and one level of Connection field traversal. Ops resolution covers direct, node-via-Connection, and interface-inheritance paths. Exposes search_types(search) from rsc.index and rsc.__init__, mirroring the search_operations/search_fields pattern with lazy BM25Okapi loading. Returns up to 10 results ranked by relevance, each with name, ops, and score keys. Co-Authored-By: Claude Sonnet 4.6 (1M context) <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.
Summary
Adds a fourth BM25 search surface to the rsc-client: a type-level corpus that aggregates all field vocabulary for each GraphQL type into a single document. Exposes it via
search_types(search), mirroring the existingsearch_operations/search_fieldspattern.Why this matters: Operations like
allClusterConnectionandslaDomainsreturn complex types (Cluster,GlobalSlaReply) with 50+ fields each. When an agent searches for "CDM clusters" or "retention-locked SLAs", BM25 can't reliably surface these operations via the ops corpus — the type's rich vocabulary gets diluted across 228-token operation documents and length-normalized into oblivion. The type corpus solves this by indexing each type's complete vocabulary in one place and resolving back to operations.Changes
mcp_indexer.py—build_types_bm25_corpus()as a fourth indexer step. Tokens: camelCase type/field name splits with org→organization and vm→virtual machine synonym expansion, first-8-word field descriptions, and one level of Connection field traversal to include child type vocabulary. Op resolution covers direct return-type, Connection→node, and interface→implementor paths.index.py—search_types(search)with lazy BM25Okapi loading. Returns up to 10 results withname,ops, andscorekeys.__init__.py— exportssearch_typesalongside existing exports.mcp_types_bm25_corpus.json— 1,562 reachable types, 1.3MB.schema-update.yml— addsmcp_types_bm25_corpus.jsonto thegit addin CI so it's committed on each schema update.Test plan
tests/test_search_types.pysearch_types("cluster")returnsClustertype with cluster operations inops