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§type Name = PrimitiveToolName
type Name = PrimitiveToolName
The type of name for this tool.
Source§fn name(&self) -> PrimitiveToolName
fn name(&self) -> PrimitiveToolName
Returns the tool’s strongly-typed name.
Source§fn display_name(&self) -> &'static str
fn display_name(&self) -> &'static str
Human-readable display name for UI (e.g., “Read File” vs “read”). Read more
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§async fn execute(
&self,
_ctx: &ToolContext<Ctx>,
input: Value,
) -> Result<ToolResult>
async fn execute( &self, _ctx: &ToolContext<Ctx>, input: Value, ) -> Result<ToolResult>
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