pub struct Validator;
Expand description
Protocol validation utilities
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn validate_uuid(uuid_str: &str) -> Result<Uuid>
pub fn validate_uuid(uuid_str: &str) -> Result<Uuid>
Sourcepub fn validate_non_empty(value: &str, field_name: &str) -> Result<()>
pub fn validate_non_empty(value: &str, field_name: &str) -> Result<()>
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<()>
pub fn validate_tool_name(name: &str) -> Result<()>
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_resource_uri(uri: &str) -> Result<()>
pub fn validate_resource_uri(uri: &str) -> Result<()>
Sourcepub fn validate_json_schema(schema: &Value) -> Result<()>
pub fn validate_json_schema(schema: &Value) -> Result<()>
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<()>
pub fn validate_tool_arguments( args: &HashMap<String, Value>, schema: &Value, ) -> Result<()>
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<()>
pub fn validate_pagination( cursor: Option<&str>, limit: Option<u32>, ) -> Result<()>
Validate pagination parameters
§Errors
Returns an error if cursor is empty, limit is 0, or limit exceeds 1000
Sourcepub fn validate_prompt_name(name: &str) -> Result<()>
pub fn validate_prompt_name(name: &str) -> Result<()>
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