pub struct ToolBuilder { /* private fields */ }
Expand description
Builder for creating tools at runtime
Implementations§
Source§impl ToolBuilder
impl ToolBuilder
Sourcepub fn new(name: impl Into<String>) -> ToolBuilder
pub fn new(name: impl Into<String>) -> ToolBuilder
Create a new tool builder with the given name
Sourcepub fn title(self, title: impl Into<String>) -> ToolBuilder
pub fn title(self, title: impl Into<String>) -> ToolBuilder
Set the tool title (display name)
Sourcepub fn description(self, description: impl Into<String>) -> ToolBuilder
pub fn description(self, description: impl Into<String>) -> ToolBuilder
Set the tool description
Sourcepub fn param<T>(self, name: T, schema: JsonSchema) -> ToolBuilder
pub fn param<T>(self, name: T, schema: JsonSchema) -> ToolBuilder
Add a parameter to the input schema
Sourcepub fn required_param<T>(self, name: T, schema: JsonSchema) -> ToolBuilder
pub fn required_param<T>(self, name: T, schema: JsonSchema) -> ToolBuilder
Add a required parameter
Sourcepub fn string_param(
self,
name: impl Into<String>,
description: impl Into<String>,
) -> ToolBuilder
pub fn string_param( self, name: impl Into<String>, description: impl Into<String>, ) -> ToolBuilder
Add a string parameter
Sourcepub fn number_param(
self,
name: impl Into<String>,
description: impl Into<String>,
) -> ToolBuilder
pub fn number_param( self, name: impl Into<String>, description: impl Into<String>, ) -> ToolBuilder
Add a number parameter
Sourcepub fn integer_param(
self,
name: impl Into<String>,
description: impl Into<String>,
) -> ToolBuilder
pub fn integer_param( self, name: impl Into<String>, description: impl Into<String>, ) -> ToolBuilder
Add an integer parameter
Sourcepub fn boolean_param(
self,
name: impl Into<String>,
description: impl Into<String>,
) -> ToolBuilder
pub fn boolean_param( self, name: impl Into<String>, description: impl Into<String>, ) -> ToolBuilder
Add a boolean parameter
Sourcepub fn output_schema(self, schema: ToolSchema) -> ToolBuilder
pub fn output_schema(self, schema: ToolSchema) -> ToolBuilder
Set the output schema
Sourcepub fn number_output(self) -> ToolBuilder
pub fn number_output(self) -> ToolBuilder
Set the output schema to expect a number result
Sourcepub fn string_output(self) -> ToolBuilder
pub fn string_output(self) -> ToolBuilder
Set the output schema to expect a string result
Sourcepub fn annotations(self, annotations: ToolAnnotations) -> ToolBuilder
pub fn annotations(self, annotations: ToolAnnotations) -> ToolBuilder
Set annotations
Sourcepub fn execute<F, Fut>(self, f: F) -> ToolBuilder
pub fn execute<F, Fut>(self, f: F) -> ToolBuilder
Set the execution function
Sourcepub fn build(self) -> Result<DynamicTool, String>
pub fn build(self) -> Result<DynamicTool, String>
Build the dynamic tool
Auto 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