pub struct McpValidator;Expand description
MCP-specific validator for tool inputs.
Implementations§
Source§impl McpValidator
impl McpValidator
Sourcepub fn require_string(params: &Value, field: &str) -> RealityResult<String>
pub fn require_string(params: &Value, field: &str) -> RealityResult<String>
Require a string field from JSON params.
Sourcepub fn optional_string(params: &Value, field: &str) -> Option<String>
pub fn optional_string(params: &Value, field: &str) -> Option<String>
Require an optional string field.
Sourcepub fn require_u64(params: &Value, field: &str) -> RealityResult<u64>
pub fn require_u64(params: &Value, field: &str) -> RealityResult<u64>
Require a u64 field.
Sourcepub fn require_f64(params: &Value, field: &str) -> RealityResult<f64>
pub fn require_f64(params: &Value, field: &str) -> RealityResult<f64>
Require a f64 field.
Sourcepub fn require_bool(params: &Value, field: &str) -> RealityResult<bool>
pub fn require_bool(params: &Value, field: &str) -> RealityResult<bool>
Require a boolean field.
Sourcepub fn validate_operation(
operation: &str,
allowed: &[&str],
) -> RealityResult<()>
pub fn validate_operation( operation: &str, allowed: &[&str], ) -> RealityResult<()>
Validate an operation string against allowed values.
Sourcepub fn validate_non_empty(value: &str, field: &str) -> RealityResult<()>
pub fn validate_non_empty(value: &str, field: &str) -> RealityResult<()>
Validate a string is non-empty.
Sourcepub fn validate_probability(value: f64, field: &str) -> RealityResult<()>
pub fn validate_probability(value: f64, field: &str) -> RealityResult<()>
Validate a float is in range [0.0, 1.0].
Auto Trait Implementations§
impl Freeze for McpValidator
impl RefUnwindSafe for McpValidator
impl Send for McpValidator
impl Sync for McpValidator
impl Unpin for McpValidator
impl UnsafeUnpin for McpValidator
impl UnwindSafe for McpValidator
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