pub struct VisibilityConfig {
pub tools: ComponentVisibilityRules,
pub resources: ComponentVisibilityRules,
pub resource_templates: ComponentVisibilityRules,
pub prompts: ComponentVisibilityRules,
pub require_read_only_tools: bool,
}Expand description
Progressive disclosure through component visibility control. Complete runtime visibility configuration for an MCP server.
This type is intentionally serializable so applications can deserialize a
user-facing config file and pass it directly to
VisibilityLayer::with_visibility_config.
Fields§
§tools: ComponentVisibilityRulesExact-name rules for tools.
resources: ComponentVisibilityRulesExact-name rules for resources. Matches resource name or uri.
resource_templates: ComponentVisibilityRulesExact-name rules for resource templates. Matches name or uriTemplate.
prompts: ComponentVisibilityRulesExact-name rules for prompts.
require_read_only_tools: boolHide every tool that is not explicitly annotated readOnlyHint: true.
Tools marked destructiveHint: true are hidden even if they also carry a
read-only hint, because conflicting safety hints should fail closed.
Implementations§
Source§impl VisibilityConfig
impl VisibilityConfig
Sourcepub fn with_allowed_tools<I, S>(self, names: I) -> Self
pub fn with_allowed_tools<I, S>(self, names: I) -> Self
Enable only the named tools.
Sourcepub fn with_disabled_tools<I, S>(self, names: I) -> Self
pub fn with_disabled_tools<I, S>(self, names: I) -> Self
Disable the named tools from both listing and direct calls.
Hide the named tools from tools/list while still permitting direct calls.
Sourcepub fn with_allowed_resources<I, S>(self, identifiers: I) -> Self
pub fn with_allowed_resources<I, S>(self, identifiers: I) -> Self
Enable only the named resources. Names and URIs both match.
Sourcepub fn with_disabled_resources<I, S>(self, identifiers: I) -> Self
pub fn with_disabled_resources<I, S>(self, identifiers: I) -> Self
Disable the named resources from both listing and direct reads.
Hide the named resources from list responses while still permitting reads.
Sourcepub fn with_allowed_resource_templates<I, S>(self, identifiers: I) -> Self
pub fn with_allowed_resource_templates<I, S>(self, identifiers: I) -> Self
Enable only the named resource templates. Names and URI templates both match.
Sourcepub fn with_disabled_resource_templates<I, S>(self, identifiers: I) -> Self
pub fn with_disabled_resource_templates<I, S>(self, identifiers: I) -> Self
Disable the named resource templates from list responses.
Hide the named resource templates from list responses.
Sourcepub fn with_allowed_prompts<I, S>(self, names: I) -> Self
pub fn with_allowed_prompts<I, S>(self, names: I) -> Self
Enable only the named prompts.
Sourcepub fn with_disabled_prompts<I, S>(self, names: I) -> Self
pub fn with_disabled_prompts<I, S>(self, names: I) -> Self
Disable the named prompts from both listing and direct gets.
Hide the named prompts from prompts/list while still permitting gets.
Sourcepub fn require_read_only_tools(self) -> Self
pub fn require_read_only_tools(self) -> Self
Hide every tool that is not explicitly annotated read-only.
Trait Implementations§
Source§impl Clone for VisibilityConfig
impl Clone for VisibilityConfig
Source§fn clone(&self) -> VisibilityConfig
fn clone(&self) -> VisibilityConfig
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 VisibilityConfig
impl Debug for VisibilityConfig
Source§impl Default for VisibilityConfig
impl Default for VisibilityConfig
Source§fn default() -> VisibilityConfig
fn default() -> VisibilityConfig
Source§impl<'de> Deserialize<'de> for VisibilityConfigwhere
VisibilityConfig: Default,
impl<'de> Deserialize<'de> for VisibilityConfigwhere
VisibilityConfig: 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 VisibilityConfig
impl PartialEq for VisibilityConfig
Source§fn eq(&self, other: &VisibilityConfig) -> bool
fn eq(&self, other: &VisibilityConfig) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for VisibilityConfig
impl Serialize for VisibilityConfig
impl Eq for VisibilityConfig
impl StructuralPartialEq for VisibilityConfig
Auto Trait Implementations§
impl Freeze for VisibilityConfig
impl RefUnwindSafe for VisibilityConfig
impl Send for VisibilityConfig
impl Sync for VisibilityConfig
impl Unpin for VisibilityConfig
impl UnsafeUnpin for VisibilityConfig
impl UnwindSafe for VisibilityConfig
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.