pub struct ParamSchema {
pub name: String,
pub param_type: String,
pub required: bool,
pub default: Option<Value>,
pub description: String,
pub aliases: Vec<String>,
}Expand description
Schema for a tool parameter.
Fields§
§name: StringParameter name.
param_type: StringType hint (string, int, bool, array, object, any).
required: boolWhether this parameter is required.
default: Option<Value>Default value if not required.
description: StringDescription for help text.
aliases: Vec<String>Alternative names/flags for this parameter (e.g., “-r”, “-R” for “recursive”).
Implementations§
Source§impl ParamSchema
impl ParamSchema
Sourcepub fn required(
name: impl Into<String>,
param_type: impl Into<String>,
description: impl Into<String>,
) -> Self
pub fn required( name: impl Into<String>, param_type: impl Into<String>, description: impl Into<String>, ) -> Self
Create a required parameter.
Sourcepub fn optional(
name: impl Into<String>,
param_type: impl Into<String>,
default: Value,
description: impl Into<String>,
) -> Self
pub fn optional( name: impl Into<String>, param_type: impl Into<String>, default: Value, description: impl Into<String>, ) -> Self
Create an optional parameter with a default value.
Sourcepub fn with_aliases(
self,
aliases: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_aliases( self, aliases: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Add alternative names/flags for this parameter.
Aliases are used for short flags like -r, -R that map to recursive.
Sourcepub fn matches_flag(&self, flag: &str) -> bool
pub fn matches_flag(&self, flag: &str) -> bool
Check if a flag name matches this parameter or any of its aliases.
Trait Implementations§
Source§impl Clone for ParamSchema
impl Clone for ParamSchema
Source§fn clone(&self) -> ParamSchema
fn clone(&self) -> ParamSchema
Returns a duplicate of the value. Read more
1.0.0 · 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 ParamSchema
impl RefUnwindSafe for ParamSchema
impl Send for ParamSchema
impl Sync for ParamSchema
impl Unpin for ParamSchema
impl UnwindSafe for ParamSchema
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