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>,
) -> ParamSchema
pub fn required( name: impl Into<String>, param_type: impl Into<String>, description: impl Into<String>, ) -> ParamSchema
Create a required parameter.
Sourcepub fn optional(
name: impl Into<String>,
param_type: impl Into<String>,
default: Value,
description: impl Into<String>,
) -> ParamSchema
pub fn optional( name: impl Into<String>, param_type: impl Into<String>, default: Value, description: impl Into<String>, ) -> ParamSchema
Create an optional parameter with a default value.
Sourcepub fn with_aliases(
self,
aliases: impl IntoIterator<Item = impl Into<String>>,
) -> ParamSchema
pub fn with_aliases( self, aliases: impl IntoIterator<Item = impl Into<String>>, ) -> ParamSchema
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 moreSource§impl Debug for ParamSchema
impl Debug for ParamSchema
Source§impl<'de> Deserialize<'de> for ParamSchema
impl<'de> Deserialize<'de> for ParamSchema
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ParamSchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ParamSchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ParamSchema
impl Serialize for ParamSchema
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ParamSchema
impl RefUnwindSafe for ParamSchema
impl Send for ParamSchema
impl Sync for ParamSchema
impl Unpin for ParamSchema
impl UnsafeUnpin 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