Skip to content

fix: add pub(super) visibility to tool_router and prompt_router macros#1

Open
decoded-brain wants to merge 1 commit into
ArthurDEV44:masterfrom
decoded-brain:fix/macro-visibility-pub-super
Open

fix: add pub(super) visibility to tool_router and prompt_router macros#1
decoded-brain wants to merge 1 commit into
ArthurDEV44:masterfrom
decoded-brain:fix/macro-visibility-pub-super

Conversation

@decoded-brain
Copy link
Copy Markdown

Problem

The #[tool_router] and #[prompt_router] macros from rmcp generate private associated functions by default. Since src/mcp/handler.rs calls these generated functions (Self::tool_router() and Self::prompt_router()) from a sibling module, the Rust compiler rejects the code with a visibility error:

error[E0624]: associated function `tool_router` is private
  --> src/mcp/handler.rs

This means cargo install rust-doctor fails to compile.

Fix

Added vis = "pub(super)" to both macro invocations in src/mcp/tools.rs:

-#[tool_router]
-#[prompt_router]
+#[tool_router(vis = "pub(super)")]
+#[prompt_router(vis = "pub(super)")]
 impl RustDoctorServer {

This makes the generated tool_router() and prompt_router() functions visible within the parent mcp module, allowing handler.rs to access them as intended.

Testing

  • Verified that the project compiles successfully with cargo build after this change.
  • No behavioral changes — this only adjusts function visibility to match the existing module structure.

The rmcp macros #[tool_router] and #[prompt_router] generate private
associated functions by default. Since handler.rs accesses these
generated functions from a sibling module (via Self::tool_router() and
Self::prompt_router()), the compiler rejects the code with a visibility
error.

Adding vis = "pub(super)" to both macro invocations makes the generated
functions visible within the parent module, fixing the compilation
failure.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

@decoded-brain is attempting to deploy a commit to the StriveX Team on Vercel.

A member of the Team first needs to authorize it.

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