pub struct Tool { /* private fields */ }Expand description
Configured FetchKit tool
Created via ToolBuilder. Provides methods for executing fetch requests,
retrieving schemas, and accessing tool metadata.
Implementations§
Source§impl Tool
impl Tool
Sourcepub fn builder() -> ToolBuilder
pub fn builder() -> ToolBuilder
Create a new tool builder
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
Human-readable display name.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Tool description, reflecting enabled features.
Sourcepub fn system_prompt(&self) -> String
pub fn system_prompt(&self) -> String
Get system prompt contribution.
Sourcepub fn input_schema(&self) -> Value
pub fn input_schema(&self) -> Value
Get input schema as JSON.
Sourcepub fn output_schema(&self) -> Value
pub fn output_schema(&self) -> Value
Get output schema as JSON.
Sourcepub fn execution(&self, args: Value) -> Result<ToolExecution, ToolError>
pub fn execution(&self, args: Value) -> Result<ToolExecution, ToolError>
Create a single-use tool execution from JSON arguments.
Sourcepub async fn execute(
&self,
req: FetchRequest,
) -> Result<FetchResponse, FetchError>
pub async fn execute( &self, req: FetchRequest, ) -> Result<FetchResponse, FetchError>
Execute the tool with the given typed request.
Sourcepub async fn execute_with_status<F>(
&self,
req: FetchRequest,
status_callback: F,
) -> Result<FetchResponse, FetchError>where
F: FnMut(ToolStatus),
pub async fn execute_with_status<F>(
&self,
req: FetchRequest,
status_callback: F,
) -> Result<FetchResponse, FetchError>where
F: FnMut(ToolStatus),
Execute the tool with status updates.
Sourcepub async fn execute_with_saver(
&self,
req: FetchRequest,
saver: Option<&dyn FileSaver>,
) -> Result<FetchResponse, FetchError>
pub async fn execute_with_saver( &self, req: FetchRequest, saver: Option<&dyn FileSaver>, ) -> Result<FetchResponse, FetchError>
Execute fetch with optional file saving.
When req.save_to_file is set, validates the path via the saver,
fetches content (including binary), and saves through the saver.
Returns metadata without inline content.
When req.save_to_file is None, behaves identically to execute.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Tool
impl !UnwindSafe for Tool
impl Freeze for Tool
impl Send for Tool
impl Sync for Tool
impl Unpin for Tool
impl UnsafeUnpin 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