pub struct ToolFilterMiddleware { /* private fields */ }Expand description
Middleware that filters tool calls by allow/deny lists.
Implementations§
Source§impl ToolFilterMiddleware
impl ToolFilterMiddleware
Sourcepub fn allow_only(
tools: impl IntoIterator<Item = impl Into<String>>,
) -> ToolFilterMiddleware
pub fn allow_only( tools: impl IntoIterator<Item = impl Into<String>>, ) -> ToolFilterMiddleware
Create a filter that only allows the specified tools.
Sourcepub fn deny(
tools: impl IntoIterator<Item = impl Into<String>>,
) -> ToolFilterMiddleware
pub fn deny( tools: impl IntoIterator<Item = impl Into<String>>, ) -> ToolFilterMiddleware
Create a filter that denies the specified tools.
Trait Implementations§
Source§impl Middleware for ToolFilterMiddleware
impl Middleware for ToolFilterMiddleware
Source§fn process_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 JsonRpcRequest,
_ctx: &'life2 mut RequestContext,
) -> Pin<Box<dyn Future<Output = MiddlewareResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
ToolFilterMiddleware: 'async_trait,
fn process_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 JsonRpcRequest,
_ctx: &'life2 mut RequestContext,
) -> Pin<Box<dyn Future<Output = MiddlewareResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
ToolFilterMiddleware: 'async_trait,
Process an incoming request. Return
Continue or Reject.Source§fn process_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_response: &'life1 mut JsonRpcResponse,
_ctx: &'life2 RequestContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn process_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_response: &'life1 mut JsonRpcResponse,
_ctx: &'life2 RequestContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Optionally process the outgoing response (no-op by default).
Auto Trait Implementations§
impl Freeze for ToolFilterMiddleware
impl RefUnwindSafe for ToolFilterMiddleware
impl Send for ToolFilterMiddleware
impl Sync for ToolFilterMiddleware
impl Unpin for ToolFilterMiddleware
impl UnsafeUnpin for ToolFilterMiddleware
impl UnwindSafe for ToolFilterMiddleware
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