fix: generate simple {} schema for tools with no parameters (#425)

This commit is contained in:
Dale Seo 2025-09-08 02:40:02 -04:00 • committed by GitHub
commit b482cfc4bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -186,9 +186,9 @@ pub fn tool(attr: TokenStream, input: TokenStream) -> syn::Result<TokenStream> {
rmcp::handler::server::common::cached_schema_for_type::<#params_ty>()
})?
} else {
// if not found, use the default EmptyObject schema
// if not found, use a simple empty JSON object
syn::parse2::<Expr>(quote! {
rmcp::handler::server::common::cached_schema_for_type::<rmcp::model::EmptyObject>()
std::sync::Arc::new(serde_json::Map::new())
})?
}
};