pub struct Tool {
pub info: ToolInfo,
pub handler: Box<dyn ToolHandler>,
pub enabled: bool,
}
Expand description
A registered tool with its handler
Fields§
§info: ToolInfo
Information about the tool
handler: Box<dyn ToolHandler>
Handler that implements the tool’s functionality
enabled: bool
Whether the tool is currently enabled
Implementations§
Source§impl Tool
impl Tool
Sourcepub fn new<H>(
name: String,
description: Option<String>,
input_schema: Value,
handler: H,
) -> Selfwhere
H: ToolHandler + 'static,
pub fn new<H>(
name: String,
description: Option<String>,
input_schema: Value,
handler: H,
) -> Selfwhere
H: ToolHandler + 'static,
Create a new tool with the given information and handler
§Arguments
name
- Name of the tooldescription
- Optional description of the toolinput_schema
- JSON schema describing the input parametershandler
- Implementation of the tool’s functionality
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if the tool is enabled
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tool
impl !RefUnwindSafe for Tool
impl Send for Tool
impl Sync for Tool
impl Unpin for Tool
impl !UnwindSafe for Tool
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