pub struct ToolDefinition {
pub name: String,
pub description: String,
pub parameters: Vec<Parameter>,
}Expand description
Definition of an available tool.
Fields§
§name: StringThe tool name (unique identifier).
description: StringHuman-readable description of what the tool does.
parameters: Vec<Parameter>Parameters accepted by the tool.
Implementations§
Source§impl ToolDefinition
impl ToolDefinition
Sourcepub fn builder(name: impl Into<String>) -> ToolDefinitionBuilder
pub fn builder(name: impl Into<String>) -> ToolDefinitionBuilder
Create a builder for a tool definition.
Sourcepub fn get_parameter(&self, name: &str) -> Option<&Parameter>
pub fn get_parameter(&self, name: &str) -> Option<&Parameter>
Get a parameter by name.
Sourcepub fn required_parameters(&self) -> impl Iterator<Item = &Parameter>
pub fn required_parameters(&self) -> impl Iterator<Item = &Parameter>
Get all required parameters.
Sourcepub fn validate_args(&self, args: &Value) -> Result<()>
pub fn validate_args(&self, args: &Value) -> Result<()>
Validate arguments against this tool’s parameters.
Trait Implementations§
Source§impl Clone for ToolDefinition
impl Clone for ToolDefinition
Source§fn clone(&self) -> ToolDefinition
fn clone(&self) -> ToolDefinition
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 ToolDefinition
impl Debug for ToolDefinition
Source§impl<'de> Deserialize<'de> for ToolDefinition
impl<'de> Deserialize<'de> for ToolDefinition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ToolDefinition
impl PartialEq for ToolDefinition
Source§impl Serialize for ToolDefinition
impl Serialize for ToolDefinition
impl StructuralPartialEq for ToolDefinition
Auto Trait Implementations§
impl Freeze for ToolDefinition
impl RefUnwindSafe for ToolDefinition
impl Send for ToolDefinition
impl Sync for ToolDefinition
impl Unpin for ToolDefinition
impl UnwindSafe for ToolDefinition
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