fastmcp.server.transforms.visibility
Visibility transform for marking component visibility state.
Each Visibility instance marks components via internal metadata. Multiple
visibility transforms can be stacked - later transforms override earlier ones.
Final filtering happens at the Provider level.
Functions
is_enabled
- No visibility mark exists (default is enabled)
- Visibility mark is True
component: Component to check.
- True if component should be enabled/visible to clients.
get_visibility_rules
save_visibility_rules
context: The context to save rules for.rules: The visibility rules to save.components: Optional hint about which component types are affected. If None, sends notifications for all types (safe default). If provided, only sends notifications for specified types.
create_visibility_transforms
get_session_transforms
enable_components
context: The context for this session.names: Component names or URIs to match.keys: Component keys to match (e.g., ).version: Component version spec to match.tags: Tags to match (component must have at least one).components: Component types to match (e.g., ).match_all: If True, matches all components regardless of other criteria.
disable_components
context: The context for this session.names: Component names or URIs to match.keys: Component keys to match (e.g., ).version: Component version spec to match.tags: Tags to match (component must have at least one).components: Component types to match (e.g., ).match_all: If True, matches all components regardless of other criteria.
reset_visibility
context: The context for this session.
apply_session_transforms
components: The components to apply session transforms to.
- The components with session transforms applied.

