pub struct LinkFetchTool { /* private fields */ }Expand description
Link fetch tool for securely retrieving web page content.
This tool fetches web pages and converts them to text or markdown format. It includes SSRF protection to prevent access to internal resources.
§Example
ⓘ
use agent_sdk::web::LinkFetchTool;
let tool = LinkFetchTool::new();
// Register with agent
tools.register(tool);Implementations§
Source§impl LinkFetchTool
impl LinkFetchTool
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new link fetch tool with default settings.
§Panics
Panics if the HTTP client cannot be built (should never happen with default settings).
Sourcepub fn with_validator(self, validator: UrlValidator) -> Self
pub fn with_validator(self, validator: UrlValidator) -> Self
Create with a custom URL validator.
Sourcepub fn with_client(self, client: Client) -> Self
pub fn with_client(self, client: Client) -> Self
Create with a custom HTTP client.
Sourcepub const fn with_default_format(self, format: FetchFormat) -> Self
pub const fn with_default_format(self, format: FetchFormat) -> Self
Set the default output format.
Trait Implementations§
Source§impl Default for LinkFetchTool
impl Default for LinkFetchTool
Source§impl<Ctx> Tool<Ctx> for LinkFetchTool
impl<Ctx> Tool<Ctx> for LinkFetchTool
Source§fn description(&self) -> &'static str
fn description(&self) -> &'static str
Human-readable description of what the tool does
Source§fn input_schema(&self) -> Value
fn input_schema(&self) -> Value
JSON schema for the tool’s input parameters
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 ToolContext<Ctx>,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 ToolContext<Ctx>,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the tool with the given input Read more
Auto Trait Implementations§
impl Freeze for LinkFetchTool
impl !RefUnwindSafe for LinkFetchTool
impl Send for LinkFetchTool
impl Sync for LinkFetchTool
impl Unpin for LinkFetchTool
impl !UnwindSafe for LinkFetchTool
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