org.llm4s.toolapi.builtin.http
HTTP tools for making web requests.
These tools provide safe HTTP access with configurable domain restrictions and method limitations.
== Configuration ==
All HTTP tools accept HttpConfig for request configuration:
- Domain allowlists and blocklists for security
- Allowed HTTP methods
- Response size limits
- Timeout configuration
== Available Tools ==
- HTTPTool: Make HTTP requests (GET, POST, PUT, DELETE, etc.)
Attributes
- Example
-
import org.llm4s.toolapi.builtin.http._ import org.llm4s.toolapi.ToolRegistry // Read-only HTTP tool (GET/HEAD only) val readOnlyTool = HTTPTool.create(HttpConfig.readOnly()) // Restricted to specific domains val restrictedTool = HTTPTool.create(HttpConfig.restricted( Seq("api.example.com", "data.example.org") )) // Full access with custom timeout val fullTool = HTTPTool.create(HttpConfig( timeoutMs = 60000, maxResponseSize = 50 * 1024 * 1024 )) val tools = new ToolRegistry(Seq(restrictedTool))
Members list
Type members
Classlikes
HTTP response result.
HTTP response result.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
HTTPResult.type
Tool for making HTTP requests.
Tool for making HTTP requests.
Features:
- Support for GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
- Request headers and body
- Domain allowlist/blocklist for security
- Response size limits
- Configurable timeout
Attributes
- Example
-
{ import org.llm4s.toolapi.builtin.http._ val httpTool = HTTPTool.create(HttpConfig( allowedDomains = Some(Seq("api.example.com")), allowedMethods = Seq("GET", "POST") )) val tools = new ToolRegistry(Seq(httpTool)) agent.run("Fetch data from https://api.example.com/data", tools)}
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
HTTPTool.type
Configuration for HTTP tool.
Configuration for HTTP tool.
Value parameters
- allowedDomains
-
Optional list of allowed domains. If None, all domains are allowed.
- allowedMethods
-
HTTP methods that are allowed.
- blockedDomains
-
List of domains that are always blocked.
- followRedirects
-
Whether to follow HTTP redirects.
- maxRedirects
-
Maximum number of redirects to follow.
- maxResponseSize
-
Maximum response size in bytes.
- timeoutMs
-
Request timeout in milliseconds.
- userAgent
-
User-Agent header to use.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
HttpConfig.type
Value members
Concrete fields
All HTTP tools with default configuration.
All HTTP tools with default configuration.