refactor(server): gate tool_catalog behind test-support#375
Merged
randomparity merged 1 commit intoMay 29, 2026
Merged
Conversation
`mcp::tool_catalog` was `pub mod` and `TOOL_DEFS` a `pub static`, exposed on the (doc-hidden) library surface solely so the binary's test-support `dump-tool-catalog` subcommand could reach the catalog. Every production caller is in-crate, routing through `dispatch` and `server`. Demote the module to `pub(crate)` and re-export `TOOL_DEFS` at `mcp::TOOL_DEFS` under `#[cfg(any(test, feature = "test-support"))]`, mirroring how `execute_tool_for_test` is gated in `server.rs`. The binary's `dump_tool_catalog` cli imports the gated re-export. In-crate callers keep the canonical `crate::mcp::tool_catalog` path. Also fix a stale `output_schema` doc reference in the wire-conformance test left by #336's rename. Closes #339
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.
mcp::tool_catalogwas apub modandTOOL_DEFSapub static, exposed on the (doc-hidden) library surface solely so the binary's test-supportdump-tool-catalogsubcommand could reach the catalog. Every production caller is in-crate, routing throughdispatchandserver.This demotes the module to
pub(crate)and re-exportsTOOL_DEFSatmcp::TOOL_DEFSunder#[cfg(any(test, feature = "test-support"))], mirroring howexecute_tool_for_testis gated inserver.rs. The binary'sdump_tool_catalogcli imports the gated re-export; in-crate callers keep the canonicalcrate::mcp::tool_catalogpath.Also fixes a stale
output_schemadoc reference inmcp_wire_conformance.rsleft by #336's rename.Verification:
cargo build -p rimap-serverclean (re-export inactive, no unreachable-pub warning)cargo clippy -p rimap-server --all-targets --all-featurescleancargo test --features test-support --test dump_tool_catalog4/4 passtool_catalogunit tests passCloses #339
🤖 Generated with Claude Code