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
|
|
@ -330,7 +330,8 @@ impl Tool {
|
|||
/// Set the input schema using a type that implements JsonSchema
|
||||
#[cfg(feature = "server")]
|
||||
pub fn with_input_schema<T: JsonSchema + 'static>(mut self) -> Self {
|
||||
self.input_schema = crate::handler::server::tool::schema_for_input::<T>();
|
||||
self.input_schema = crate::handler::server::tool::schema_for_input::<T>()
|
||||
.unwrap_or_else(|e| panic!("Invalid input schema for tool '{}': {}", self.name, e));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue