pub struct DynamicToolRegistry<T> { /* private fields */ }Expand description
A tool registry wrapper that adds runtime filter and restriction management.
Wraps any T: ToolRegistry and layers per-server state on top:
- Filters control which tools are visible in
list_tools(). - Restrictions are stored here and exposed for protocol crates to
read at call time via
get_param_restrictions. - Groups map group names to sets of server names for access control.
Implementations§
Source§impl<T> DynamicToolRegistry<T>
impl<T> DynamicToolRegistry<T>
Sourcepub fn new(
inner: T,
filters: HashMap<String, ToolFilter>,
restrictions: HashMap<String, ParamRestrictions>,
groups: HashMap<String, Vec<String>>,
) -> Self
pub fn new( inner: T, filters: HashMap<String, ToolFilter>, restrictions: HashMap<String, ParamRestrictions>, groups: HashMap<String, Vec<String>>, ) -> Self
Create a new dynamic tool registry wrapping the given inner registry.
Sourcepub fn get_param_restrictions(&self, server: &str) -> Option<ParamRestrictions>
pub fn get_param_restrictions(&self, server: &str) -> Option<ParamRestrictions>
Read the current parameter restrictions for a server.
Protocol crates call this at tool-call time to enforce restrictions.
Sourcepub fn get_filter(&self, server: &str) -> Option<ToolFilter>
pub fn get_filter(&self, server: &str) -> Option<ToolFilter>
Read the current filter for a server.
Trait Implementations§
Source§impl<T: ToolRegistry> AdminToolRegistry for DynamicToolRegistry<T>
impl<T: ToolRegistry> AdminToolRegistry for DynamicToolRegistry<T>
Source§async fn list_upstreams(&self) -> Vec<ToolUpstreamEntry>
async fn list_upstreams(&self) -> Vec<ToolUpstreamEntry>
List all upstream tool servers with their current state.
Source§async fn list_groups(&self) -> HashMap<String, Vec<String>>
async fn list_groups(&self) -> HashMap<String, Vec<String>>
List all configured access groups.
Source§async fn update_filter(
&self,
server: &str,
filter: Option<ToolFilter>,
) -> Result<()>
async fn update_filter( &self, server: &str, filter: Option<ToolFilter>, ) -> Result<()>
Update the tool filter for a specific upstream server.
Source§async fn update_param_restrictions(
&self,
server: &str,
restrictions: ParamRestrictions,
) -> Result<()>
async fn update_param_restrictions( &self, server: &str, restrictions: ParamRestrictions, ) -> Result<()>
Update parameter restrictions for a specific upstream server.
Source§impl<T: ToolRegistry> ToolRegistry for DynamicToolRegistry<T>
impl<T: ToolRegistry> ToolRegistry for DynamicToolRegistry<T>
Source§async fn list_tools(&self) -> Vec<ToolEntry>
async fn list_tools(&self) -> Vec<ToolEntry>
Lists all tools available through the router.
Auto Trait Implementations§
impl<T> !Freeze for DynamicToolRegistry<T>
impl<T> RefUnwindSafe for DynamicToolRegistry<T>where
T: RefUnwindSafe,
impl<T> Send for DynamicToolRegistry<T>where
T: Send,
impl<T> Sync for DynamicToolRegistry<T>where
T: Sync,
impl<T> Unpin for DynamicToolRegistry<T>where
T: Unpin,
impl<T> UnsafeUnpin for DynamicToolRegistry<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for DynamicToolRegistry<T>where
T: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more