fix: strip and validate tool outputSchema and inputSchema (#860)
* fix: remove unnecessary fields from tools' outputSchema * fix: validate input schema root type per MCP spec
This commit is contained in:
parent
8f558d83be
commit
254f04a764
1 changed files with 158 additions and 65 deletions
|
|
@ -232,6 +232,13 @@ pub fn tool(attr: TokenStream, input: TokenStream) -> syn::Result<TokenStream> {
|
|||
// if found, use the Parameters schema
|
||||
syn::parse2::<Expr>(quote! {
|
||||
rmcp::handler::server::common::schema_for_input::<#params_ty>()
|
||||
.unwrap_or_else(|e| {
|
||||
panic!(
|
||||
"Invalid input schema for `{}`: {}",
|
||||
std::any::type_name::<#params_ty>(),
|
||||
e
|
||||
)
|
||||
})
|
||||
})?
|
||||
} else {
|
||||
// if not found, use a default empty JSON schema object
|
||||
|
|
|
|||
Loading…
Reference in a new issue