pub struct Validator;
Expand description
Re-export commonly used types Protocol validation utilities
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn validate_non_empty(value: &str, field_name: &str) -> Result<(), Error>
pub fn validate_non_empty(value: &str, field_name: &str) -> Result<(), Error>
Validate that a string is not empty
§Errors
Returns an error if the string is empty or contains only whitespace
Sourcepub fn validate_tool_name(name: &str) -> Result<(), Error>
pub fn validate_tool_name(name: &str) -> Result<(), Error>
Validate a tool name (must be alphanumeric with underscores)
§Errors
Returns an error if the name is empty or contains invalid characters
Sourcepub fn validate_json_schema(schema: &Value) -> Result<(), Error>
pub fn validate_json_schema(schema: &Value) -> Result<(), Error>
Validate JSON schema
§Errors
Returns an error if the schema is not a valid JSON object with a type field
Sourcepub fn validate_tool_arguments(
args: &HashMap<String, Value>,
schema: &Value,
) -> Result<(), Error>
pub fn validate_tool_arguments( args: &HashMap<String, Value>, schema: &Value, ) -> Result<(), Error>
Validate tool arguments against a schema
§Errors
Returns an error if required arguments are missing from the provided arguments
Sourcepub fn validate_pagination(
cursor: Option<&str>,
limit: Option<u32>,
) -> Result<(), Error>
pub fn validate_pagination( cursor: Option<&str>, limit: Option<u32>, ) -> Result<(), Error>
Validate pagination parameters
§Errors
Returns an error if cursor is empty, limit is 0, or limit exceeds 1000
Auto Trait Implementations§
impl Freeze for Validator
impl RefUnwindSafe for Validator
impl Send for Validator
impl Sync for Validator
impl Unpin for Validator
impl UnwindSafe for Validator
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