Open
Description
Describe the bug
When I try to use the toolbox macro on a type that has generics, it will not work
To Reproduce
#[tool(tool_box)]
impl<GS: GraphService> GraphMcp<GS> {
pub fn new(graph_service: GS) -> Self {
Self {
graph_service: Arc::new(graph_service),
}
}
#[tool(description = "Get a list of nodes")]
async fn list_nodes(&self) -> Result<CallToolResult, McpError> {
Ok(CallToolResult::success(vec![]))
}
}
// const_string!(Echo = "echo");
#[tool(tool_box)]
impl<GS: GraphService> ServerHandler for GraphMcp<GS> {
fn get_info(&self) -> ServerInfo {
ServerInfo {
protocol_version: ProtocolVersion::V_2024_11_05,
capabilities: ServerCapabilities::builder().enable_tools().build(),
server_info: Implementation::from_build_env(),
instructions: Some("This server provides access to the DataCards API.".to_string()),
}
}
}
Expected behavior
macro works with types which have Generics
Logs
17 | impl<GS: GraphService> DataCardsMcp<GS> {
| ^ no rules expected this token in macro call
|
note: while trying to match `{`
--> /Users/work/.cargo/git/checkouts/rust-sdk-773cd6d57c4837f3/6a74451/crates/rmcp/src/handler/server/tool.rs:431:21
Additional context
Add any other context about the problem here.