pub struct ComponentVisibilityRules {
pub allow: Option<BTreeSet<String>>,
pub deny: BTreeSet<String>,
pub hide: BTreeSet<String>,
}Expand description
Progressive disclosure through component visibility control. Exact-name visibility rules for one MCP component family.
Matching is case-sensitive and exact. Deny rules win over allow rules. When
allow is Some, only matching identifiers are enabled; when it is None,
every identifier is enabled unless it appears in deny. Hidden identifiers
remain callable/readable/gettable, but are omitted from list_* responses.
Resources and resource templates are matched by both name and URI/URI
template, so config authors can use whichever identifier is most stable for
their server.
Fields§
§allow: Option<BTreeSet<String>>Exact identifiers to enable. None means no allowlist is configured.
An empty set inside Some intentionally disables the entire component
family.
deny: BTreeSet<String>Exact identifiers to disable from both listing and direct use.
hide: BTreeSet<String>Exact identifiers to omit from lists while still permitting direct use.
Implementations§
Source§impl ComponentVisibilityRules
impl ComponentVisibilityRules
Sourcepub fn allow<I, S>(names: I) -> Self
pub fn allow<I, S>(names: I) -> Self
Create rules that enable only the given exact identifiers.
Sourcepub fn hide<I, S>(names: I) -> Self
pub fn hide<I, S>(names: I) -> Self
Create rules that omit the given exact identifiers from lists.
Sourcepub fn with_allowed<I, S>(self, names: I) -> Self
pub fn with_allowed<I, S>(self, names: I) -> Self
Replace the allowlist with the given exact identifiers.
Sourcepub fn with_disabled<I, S>(self, names: I) -> Self
pub fn with_disabled<I, S>(self, names: I) -> Self
Replace the denylist with the given exact identifiers.
Replace the hidden list with the given exact identifiers.
Sourcepub fn is_enabled(&self, identifier: &str) -> bool
pub fn is_enabled(&self, identifier: &str) -> bool
Check whether a single exact identifier is enabled for direct use.
Sourcepub fn is_enabled_any<'a, I>(&self, identifiers: I) -> boolwhere
I: IntoIterator<Item = &'a str>,
pub fn is_enabled_any<'a, I>(&self, identifiers: I) -> boolwhere
I: IntoIterator<Item = &'a str>,
Check whether any identifier for the same component is enabled for direct use.
Denying any identifier disables the component. When an allowlist is present, at least one identifier must be allowlisted.
Sourcepub fn is_listed(&self, identifier: &str) -> bool
pub fn is_listed(&self, identifier: &str) -> bool
Check whether a single exact identifier should appear in list responses.
Sourcepub fn is_listed_any<'a, I>(&self, identifiers: I) -> boolwhere
I: IntoIterator<Item = &'a str>,
pub fn is_listed_any<'a, I>(&self, identifiers: I) -> boolwhere
I: IntoIterator<Item = &'a str>,
Check whether any identifier for the same component should appear in lists.
Trait Implementations§
Source§impl Clone for ComponentVisibilityRules
impl Clone for ComponentVisibilityRules
Source§fn clone(&self) -> ComponentVisibilityRules
fn clone(&self) -> ComponentVisibilityRules
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ComponentVisibilityRules
impl Debug for ComponentVisibilityRules
Source§impl Default for ComponentVisibilityRules
impl Default for ComponentVisibilityRules
Source§fn default() -> ComponentVisibilityRules
fn default() -> ComponentVisibilityRules
Source§impl<'de> Deserialize<'de> for ComponentVisibilityRuleswhere
ComponentVisibilityRules: Default,
impl<'de> Deserialize<'de> for ComponentVisibilityRuleswhere
ComponentVisibilityRules: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ComponentVisibilityRules
impl PartialEq for ComponentVisibilityRules
Source§fn eq(&self, other: &ComponentVisibilityRules) -> bool
fn eq(&self, other: &ComponentVisibilityRules) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ComponentVisibilityRules
impl Serialize for ComponentVisibilityRules
impl Eq for ComponentVisibilityRules
impl StructuralPartialEq for ComponentVisibilityRules
Auto Trait Implementations§
impl Freeze for ComponentVisibilityRules
impl RefUnwindSafe for ComponentVisibilityRules
impl Send for ComponentVisibilityRules
impl Sync for ComponentVisibilityRules
impl Unpin for ComponentVisibilityRules
impl UnsafeUnpin for ComponentVisibilityRules
impl UnwindSafe for ComponentVisibilityRules
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.