Describe the bug
The example under Tool cannot run.
To Reproduce
Steps to reproduce the behavior:
- Create a project with below code
use rmcp::{tool, tool_router, ServiceExt, transport::stdio};
#[derive(Clone)]
struct Calculator;
#[tool_router(server_handler)]
impl Calculator {
#[tool(description = "Add two numbers")]
fn add(&self, #[tool(param)] a: i32, #[tool(param)] b: i32) -> String {
(a + b).to_string()
}
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let service = Calculator.serve(stdio()).await?;
service.waiting().await?;
Ok(())
}
- Try to run it
- See the error
error: expected non-macro attribute, found attribute macro `tool`
--> src\main.rs:9:21
|
9 | fn add(&self, #[tool(param)] a: i32, #[tool(param)] b: i32) -> String {
| ^^^^ not a non-macro attribute
Expected behavior
It should run successfully.
Additional context
- Dependency:
rmcp = { version = "1.5.0", features = ["server", "transport-io"] }
- rust version 1.95.0
- OS: Windows
Describe the bug
The example under Tool cannot run.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It should run successfully.
Additional context
rmcp = { version = "1.5.0", features = ["server", "transport-io"] }