Skip to main content

make_web_fetch

Function make_web_fetch 

Source
pub fn make_web_fetch(options: MakeWebFetchOptions) -> Result<FunctionTool>
Expand description

Creates a web fetch tool.

The tool GETs url (http and https only), reads at most max_bytes of the body, decodes it with the response charset, converts HTML and XML to markdown and truncates the result to max_content_chars. In markdown mode that is the result; in agentic mode a fresh analyst agent answers prompt from it. The request is cancelled with the call.

use strands::vended_tools::web_fetch::{MakeWebFetchOptions, WebFetchMode, make_web_fetch};

let fetch = make_web_fetch(MakeWebFetchOptions::builder().mode(WebFetchMode::Markdown).build())?;
assert_eq!(strands::Tool::name(&fetch), "web_fetch");

ยงErrors

When max_bytes or max_content_chars is 0.