Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Implement revision 2025-03-26 #56

Closed
wants to merge 10 commits into from
9 changes: 5 additions & 4 deletions crates/rmcp-macros/src/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu
name: #name.into(),
description: Some(#description.into()),
input_schema: #schema.into(),
annotations: None
}
}
}
Expand Down Expand Up @@ -413,10 +414,10 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu
Some(line)
}
});
let trivial_argrextraction_part = quote! {
let trivial_arg_extraction_part = quote! {
#(#trivial_args)*
};
let processed_argrextraction_part = match &mut tool_macro_attrs.params {
let processed_arg_extraction_part = match &mut tool_macro_attrs.params {
ToolParams::Aggregated { rust_type } => {
let PatType { pat, ty, .. } = rust_type;
quote! {
Expand Down Expand Up @@ -487,8 +488,8 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu
#raw_fn_vis async fn #tool_call_fn_ident(context: rmcp::handler::server::tool::ToolCallContext<'_, Self>)
-> std::result::Result<rmcp::model::CallToolResult, rmcp::Error> {
use rmcp::handler::server::tool::*;
#trivial_argrextraction_part
#processed_argrextraction_part
#trivial_arg_extraction_part
#processed_arg_extraction_part
#call
}
}
Expand Down
Loading
Loading