feat: add trait-based tool declaration (#677)

* feat: add trait-based tool declaration

* fix: typo

* fix: add docs, make more idomatic patterns, allow for empty parameters and return types

* fix: format code

* fix: add default trait

* fix: docs typo
This commit is contained in:
EvianZhang 2026-02-26 01:23:37 +08:00 • committed by GitHub
commit 6c336a90c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -238,10 +238,7 @@ pub fn tool(attr: TokenStream, input: TokenStream) -> syn::Result<TokenStream> {
// if not found, use a default empty JSON schema object
// TODO: should be updated according to the new specifications
syn::parse2::<Expr>(quote! {
std::sync::Arc::new(serde_json::json!({
"type": "object",
"properties": {}
}).as_object().unwrap().clone())
rmcp::handler::server::common::schema_for_empty_input()
})?
}
};