fix: generate simple {} schema for tools with no parameters (#425)
This commit is contained in:
parent
cb4abcb87b
commit
b482cfc4bb
2 changed files with 3 additions and 3 deletions
|
|
@ -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())
|
||||
})?
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ async fn test_tool_macros() {
|
|||
async fn test_tool_macros_with_empty_param() {
|
||||
let _attr = Server::empty_param_tool_attr();
|
||||
println!("{_attr:?}");
|
||||
assert_eq!(_attr.input_schema.get("type").unwrap(), "object");
|
||||
assert!(_attr.input_schema.get("type").is_none());
|
||||
assert!(_attr.input_schema.get("properties").is_none());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue