Add detect_dead_constants MCP tool#652
Draft
st0012 wants to merge 3 commits intoadd-pagination-support-rubydex-mcpfrom
Draft
Add detect_dead_constants MCP tool#652st0012 wants to merge 3 commits intoadd-pagination-support-rubydex-mcpfrom
st0012 wants to merge 3 commits intoadd-pagination-support-rubydex-mcpfrom
Conversation
Add offset/total pagination to search_declarations, get_descendants,
and find_constant_references. Uses a two-pass paginate! macro: filter
pass counts total, map pass builds JSON only for the requested page.
- search_declarations: response wrapped in {results, total} envelope
- get_descendants: gains limit (default 100, max 500) and offset
- find_constant_references: gains offset; total always present
- limit=0 treated as default to guard against accidental empty pages
- Tool descriptions and server instructions mention pagination
- Add GraphTest::into_graph() for test graph injection
- Add 26 unit tests calling tool handlers directly (no process spawn)
- Windows-compatible test URIs via test_root()/test_uri() helpers
Add MCP Server section covering the two-pass pagination approach, result ordering guarantees (stable within a session, may vary across restarts due to parallel indexing), and key file references.
Find Ruby classes, modules, and constants with zero resolved references across the codebase. Uses rubydex's semantic resolution for high accuracy compared to string-matching approaches. - Params: kind filter, file_path prefix, limit/offset pagination - Response: name, kind, file, line, owner per dead constant - Excludes infrastructure declarations (Object, BasicObject, Module, Class) - Sorted by FQN for deterministic pagination - 13 tests covering classes, modules, constants, aliases, includes, superclass references, kind filtering, pagination, and file path filtering
78806c4 to
9fc7b28
Compare
ab1dff0 to
ecd1dc0
Compare
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
detect_dead_constantsMCP tool that finds Ruby classes, modules, and constants with zero resolved references across the codebasekindfilter,file_pathprefix filter, andlimit/offsetpaginationSERVER_INSTRUCTIONSupdated with dead code detection guide