pub struct WebFetchTool { /* private fields */ }Expand description
Tool that fetches content from a URL using fetchkit
THREAT[TM-API-008]: SSRF protection via fetchkit DnsPolicy Mitigation: Default FetchOptions uses DnsPolicy::block_private_ips(), which blocks loopback, RFC1918, link-local (cloud metadata), and other reserved IP ranges via resolve-then-check with DNS pinning.
File download: when save_to_file is provided, content is saved through
the session filesystem (SessionFileSystem) via the SessionFileSaver adapter.
Implementations§
Source§impl WebFetchTool
impl WebFetchTool
Sourcepub fn new(enable_save_to_file: bool, bot_auth: Option<BotAuthConfig>) -> Self
pub fn new(enable_save_to_file: bool, bot_auth: Option<BotAuthConfig>) -> Self
Create a new WebFetchTool with file download and optional bot-auth signing.
Trait Implementations§
Source§impl Default for WebFetchTool
impl Default for WebFetchTool
Source§impl Tool for WebFetchTool
impl Tool for WebFetchTool
Source§fn narrate(
&self,
tool_call: &ToolCall,
phase: ToolNarrationPhase,
locale: Option<&str>,
_ctx: ToolNarrationContext<'_>,
) -> Option<String>
fn narrate( &self, tool_call: &ToolCall, phase: ToolNarrationPhase, locale: Option<&str>, _ctx: ToolNarrationContext<'_>, ) -> Option<String>
Returns backend-authored narration for a call to this tool, e.g.
“Read AGENTS.md”. Read more
Source§fn display_name(&self) -> Option<&str>
fn display_name(&self) -> Option<&str>
Returns a human-readable display name for UI rendering. Read more
Source§fn description(&self) -> &str
fn description(&self) -> &str
Returns a description of what the tool does. Read more
Source§fn parameters_schema(&self) -> Value
fn parameters_schema(&self) -> Value
Returns the JSON schema for the tool’s parameters. Read more
Source§fn requires_context(&self) -> bool
fn requires_context(&self) -> bool
Returns true if this tool requires context for execution. Read more
Source§fn hints(&self) -> ToolHints
fn hints(&self) -> ToolHints
Returns semantic hints describing the tool’s behavioral properties. Read more
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
arguments: Value,
) -> Pin<Box<dyn Future<Output = ToolExecutionResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
arguments: Value,
) -> Pin<Box<dyn Future<Output = ToolExecutionResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool with the given arguments. Read more
Source§fn execute_with_context<'life0, 'life1, 'async_trait>(
&'life0 self,
arguments: Value,
context: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolExecutionResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute_with_context<'life0, 'life1, 'async_trait>(
&'life0 self,
arguments: Value,
context: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolExecutionResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the tool with context. Read more
Source§fn policy(&self) -> ToolPolicy
fn policy(&self) -> ToolPolicy
Returns the tool policy (auto or requires_approval). Read more
Source§fn as_background_executable(&self) -> Option<&dyn BackgroundExecutableTool>
fn as_background_executable(&self) -> Option<&dyn BackgroundExecutableTool>
Returns native background execution support when this tool opts into
detached execution via
hints().supports_background.Source§fn deferrable_policy(&self) -> DeferrablePolicy
fn deferrable_policy(&self) -> DeferrablePolicy
Deferral policy for progressive tool-schema disclosure (tool search).
Hot-path or “consult-first” tools can return
DeferrablePolicy::Never
to always keep their full schema directly callable. Defaults to
DeferrablePolicy::Automatic.Source§fn to_definition(&self) -> ToolDefinition
fn to_definition(&self) -> ToolDefinition
Convert this tool to a ToolDefinition for the agent config. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for WebFetchTool
impl !UnwindSafe for WebFetchTool
impl Freeze for WebFetchTool
impl Send for WebFetchTool
impl Sync for WebFetchTool
impl Unpin for WebFetchTool
impl UnsafeUnpin for WebFetchTool
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request