-
Notifications
You must be signed in to change notification settings - Fork 471
Description
Is your feature request related to a problem? Please describe.
I'm writing a tool which internally holds state that is not Send, so the tool itself is an async fn which is not Send. The tool macro forces the function to return a future which is Send.
rust-sdk/crates/rmcp-macros/src/tool.rs
Line 272 in 44129e4
| // 2. make return type: `std::pin::Pin<Box<dyn std::future::Future<Output = #ReturnType> + Send + '_>>` |
Describe the solution you'd like
I'd like an attribute to the macro, like the existing name and annotations, which would control the + Send (and maybe also one which would control the lifetime, not sure). It could be send = false.
Describe alternatives you've considered
I have a workaround which is not bad. I simply duplicate the signature of the function and have the one with the tool macro be implemented with unreachable!().
#[rmcp::tool]
async fn _my_tool(params: Parameters<Request>) -> Result<Json<Response>, Error> {
unreachable!()
}
async fn my_tool(params: Parameters<Request>) -> Result<Json<Response>, Error> {
// actual implementation
}Then later I use _my_tool_tool_attr() instead of my_tool_tool_attr().
Additional context
I'm not using any tool router or server, so I probably don't need the fact that the function signature is changed. I'm calling the function myself.