pub struct SafetyConfig {
pub allow_dangerous: bool,
}Expand description
Configuration for safety/guarding of dangerous MCP operations.
Fields§
§allow_dangerous: boolIf true, dangerous operations (trade, funding) are allowed without
the acknowledged parameter being true.
Implementations§
Source§impl SafetyConfig
impl SafetyConfig
Sourcepub fn new(allow_dangerous: bool) -> Self
pub fn new(allow_dangerous: bool) -> Self
Create a new safety configuration.
allow_dangerous should be true only when the user explicitly opts in
(e.g., via --allow-dangerous CLI flag).
Sourcepub fn check_group(&self, group: &ServiceGroup) -> Result<(), String>
pub fn check_group(&self, group: &ServiceGroup) -> Result<(), String>
Check whether an operation in the given service group is allowed.
Returns Ok(()) if allowed, or Err(message) with guidance.
Sourcepub fn check_operation(
&self,
group: &ServiceGroup,
acknowledged: bool,
) -> Result<(), String>
pub fn check_operation( &self, group: &ServiceGroup, acknowledged: bool, ) -> Result<(), String>
Check whether a dangerous operation is allowed with the given acknowledged flag.
Must provide acknowledged: true for dangerous groups unless allow_dangerous is set.
Trait Implementations§
Source§impl Clone for SafetyConfig
impl Clone for SafetyConfig
Source§fn clone(&self) -> SafetyConfig
fn clone(&self) -> SafetyConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SafetyConfig
impl RefUnwindSafe for SafetyConfig
impl Send for SafetyConfig
impl Sync for SafetyConfig
impl Unpin for SafetyConfig
impl UnsafeUnpin for SafetyConfig
impl UnwindSafe for SafetyConfig
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