Skip to content

Counter example in crates/rmcp/README.md does not compile #394

@RobJellinghaus

Description

@RobJellinghaus

Describe the bug
The example in crates/rmcp/README.md does not build with rmcp 0.6.0.

To Reproduce
Steps to reproduce the behavior:

  1. Copy the code into src/main.rs in a new counter project
  2. cargo build

Expected behavior
It builds successfully.

Logs
The errors actually observed (edited for brevity):

error: cannot find attribute `tool_handler` in this scope
  --> src/main.rs:39:3
39 | #[tool_handler]
   |   ^^^^^^^^^^^^
help: consider importing one of these attribute macros
1  + use rmcp::tool_handler;
1  + use rmcp_macros::tool_handler;

error[E0405]: cannot find trait `Future` in this scope
  --> src/main.rs:20:5
20 |     #[tool(description = "Increment the counter by 1")]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
   = note: this error originates in the attribute macro `tool` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this trait
1  + use std::future::Future;

warning: unused import: `handler::server::tool::ToolCallContext`
 --> src/main.rs:1:94
1 | ...:*, tool, tool_router, transport::stdio, handler::server::tool::ToolCallContext, handler::server::router::tool::ToolRout...
  |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: `#[warn(unused_imports)]` on by default

Additional context
I will make a PR to fix this once I verify the counter server works locally under Claude Code.

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