pub struct ToolBuilder { /* private fields */ }
Expand description
Builder for creating tool definitions.
Provides a fluent API for constructing tools with parameters and validation.
Implementations§
Source§impl ToolBuilder
impl ToolBuilder
Sourcepub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
Create a new tool builder.
Sourcepub fn parameter(
self,
name: impl Into<String>,
param_type: impl Into<String>,
description: impl Into<String>,
) -> Self
pub fn parameter( self, name: impl Into<String>, param_type: impl Into<String>, description: impl Into<String>, ) -> Self
Add a parameter to the tool.
§Arguments
name
- Parameter nameparam_type
- Parameter type (e.g., “string”, “number”, “boolean”)description
- Parameter description
Sourcepub fn enum_parameter(
self,
name: impl Into<String>,
description: impl Into<String>,
values: Vec<String>,
) -> Self
pub fn enum_parameter( self, name: impl Into<String>, description: impl Into<String>, values: Vec<String>, ) -> Self
Add an enum parameter with specific allowed values.
Sourcepub fn array_parameter(
self,
name: impl Into<String>,
description: impl Into<String>,
item_type: impl Into<String>,
) -> Self
pub fn array_parameter( self, name: impl Into<String>, description: impl Into<String>, item_type: impl Into<String>, ) -> Self
Add an array parameter.
Sourcepub fn object_parameter(
self,
name: impl Into<String>,
description: impl Into<String>,
properties: Map<String, Value>,
) -> Self
pub fn object_parameter( self, name: impl Into<String>, description: impl Into<String>, properties: Map<String, Value>, ) -> Self
Add an object parameter with nested properties.
Sourcepub fn additional_property(self, key: impl Into<String>, value: Value) -> Self
pub fn additional_property(self, key: impl Into<String>, value: Value) -> Self
Add additional schema properties.
Trait Implementations§
Source§impl Clone for ToolBuilder
impl Clone for ToolBuilder
Source§fn clone(&self) -> ToolBuilder
fn clone(&self) -> ToolBuilder
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 ToolBuilder
impl RefUnwindSafe for ToolBuilder
impl Send for ToolBuilder
impl Sync for ToolBuilder
impl Unpin for ToolBuilder
impl UnwindSafe for ToolBuilder
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