Skip to content

tool macro expands to serde_json without re-export #487

@jonaro00

Description

@jonaro00

Describe the bug
tool macro expands to serde_json here which causes compilation error in crates that don't have it as a dependency.

To Reproduce
Steps to reproduce the behavior:

  1. cargo new asdf
  2. cd asdf
  3. cargo add rcmp -F macros
  4. add basic tool call to src/main.rs
struct A;

#[rmcp::tool_router]
impl A {
    #[rmcp::tool]
    async fn foo() {}
}
  1. error[E0433]: failed to resolve: use of unresolved module or unlinked crate serde_json

Proposed solution
Other location in the macro already assumes the downstream crate depends on rmcp, so expanding the macro to use the re-exported ::rmcp::serde_json::... should work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions