FetchTool provides a simple interface to fetch content from URLs using various HTTP methods.
Constructor
No parameters required. Inherits fromBaseTool.
Methods
fetch_url
Fetch content from a URL using HTTP requests.str
required
The URL to fetch
str
HTTP method to use: GET, POST, PUT, DELETE, etc. (default: “GET”)
Dict[str, str]
Optional headers to include in the request
str
Optional body content for POST/PUT requests
Usage
Basic GET request
GET request with headers
POST request with body
Other HTTP methods
Error handling
The tool returns error messages as strings:Use cases
- Fetching data from REST APIs
- Web scraping simple HTML pages
- Testing API endpoints
- Downloading content from URLs
- Webhook testing
Notes
FetchTool uses
httpx under the hood with a 30-second timeout for all requests.Source reference
src/agentor/tools/fetch.py:8