← All tools

Code Engineering

Web Fetch

Fetch a URL and return its text body with HTML stripped to plaintext.

web_fetch

Overview

Distinct from web_scrape (HTML-structured scraping) and web_search (search-engine queries). web_fetch is the read-the-page-as-text verb a coding agent uses to enrich its understanding from external docs.

How it works

Java HttpClient with normal redirect-following and a 10s connect timeout. Strips <script> and <style> blocks before tag-stripping; collapses runs of blank lines.

Example

When a user asks:

What does the README of the spring-ai repo say about prompt caching?

the agent calls the tool:

web_fetch(url="https://raw.githubusercontent.com/spring-projects/spring-ai/main/README.md")

and gets back: Spring AI — README ... ## Prompt caching Spring AI exposes a CachingChatClient that wraps any provider... ...

What it's good for

Real scenarios where agents put this tool to work.

Read documentation referenced in a comment before editing the code
Pull release notes for a dependency before deciding to upgrade

Source

Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/code/web/WebFetchTool.java in the swarm-ai repository.

Open web_fetch on GitHub →