pub struct SchemaValidator { /* private fields */ }Expand description
Middleware that validates tool call input against the tool’s JSON Schema.
Performs lightweight structural validation: checks that the input is an object, required fields are present, and property types match the schema. This catches obvious input errors before the tool executes, without depending on a full JSON Schema validation library.
Implementations§
Source§impl SchemaValidator
impl SchemaValidator
Sourcepub fn new(registry: &ToolRegistry) -> Self
pub fn new(registry: &ToolRegistry) -> Self
Create a new schema validator from the current tool registry.
Snapshots all tool definitions at construction time. Tools registered after this call will not be validated.
Trait Implementations§
Source§impl ToolMiddleware for SchemaValidator
impl ToolMiddleware for SchemaValidator
Source§fn process<'a>(
&'a self,
call: &'a ToolCall,
ctx: &'a ToolContext,
next: Next<'a>,
) -> WasmBoxedFuture<'a, Result<ToolOutput, ToolError>>
fn process<'a>( &'a self, call: &'a ToolCall, ctx: &'a ToolContext, next: Next<'a>, ) -> WasmBoxedFuture<'a, Result<ToolOutput, ToolError>>
Process a tool call, optionally delegating to the next middleware/tool.
Auto Trait Implementations§
impl Freeze for SchemaValidator
impl RefUnwindSafe for SchemaValidator
impl Send for SchemaValidator
impl Sync for SchemaValidator
impl Unpin for SchemaValidator
impl UnsafeUnpin for SchemaValidator
impl UnwindSafe for SchemaValidator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more