Documentation
¶
Index ¶
- Variables
- type FetchURLArgs
- type FetchURLEncoding
- type WebTool
- type WebToolOption
- func WithAllowPrivateNetwork(allow bool) WebToolOption
- func WithHTTPTimeout(timeout time.Duration) WebToolOption
- func WithMaxFetchBytes(maxBytes int64) WebToolOption
- func WithMaxRedirects(maxRedirects int) WebToolOption
- func WithProxyURL(proxyRawURL string) WebToolOption
- func WithUserAgent(userAgent string) WebToolOption
Constants ¶
This section is empty.
Variables ¶
var ErrNoContentExtracted = errors.New("no content extracted")
Functions ¶
This section is empty.
Types ¶
type FetchURLArgs ¶
type FetchURLEncoding ¶
type FetchURLEncoding string
const ( FetchEncodingAuto FetchURLEncoding = "auto" FetchEncodingText FetchURLEncoding = "text" FetchEncodingBinary FetchURLEncoding = "binary" )
type WebTool ¶
type WebTool struct {
// contains filtered or unexported fields
}
WebTool is an instance-owned HTTP fetchURL tool.
Default security posture is conservative: - only http/https URLs are allowed - localhost, private, link-local, multicast and reserved IP ranges are blocked - redirects are revalidated - response bytes are bounded.
func NewWebTool ¶
func NewWebTool(opts ...WebToolOption) (*WebTool, error)
func (*WebTool) FetchURL ¶
func (wt *WebTool) FetchURL(ctx context.Context, args FetchURLArgs) ([]spec.ToolOutputUnion, error)
func (*WebTool) FetchURLTool ¶
type WebToolOption ¶
func WithAllowPrivateNetwork ¶
func WithAllowPrivateNetwork(allow bool) WebToolOption
WithAllowPrivateNetwork allows fetching private/internal network addresses.
Keep this false for autonomous LLM usage unless the host application has its own network sandbox.
func WithHTTPTimeout ¶
func WithHTTPTimeout(timeout time.Duration) WebToolOption
WithHTTPTimeout sets the HTTP client timeout.
A zero timeout disables the client-level timeout, but callers should still use context deadlines or registry call timeouts.
func WithMaxFetchBytes ¶
func WithMaxFetchBytes(maxBytes int64) WebToolOption
WithMaxFetchBytes sets the maximum bytes downloaded for one fetch.
It cannot exceed toolutil.MaxFileReadBytes, so the web tool remains aligned with local file read safety limits.
func WithMaxRedirects ¶
func WithMaxRedirects(maxRedirects int) WebToolOption
WithMaxRedirects sets the maximum number of redirects.
Use 0 to disable redirects.
func WithProxyURL ¶
func WithProxyURL(proxyRawURL string) WebToolOption
WithProxyURL configures an HTTP/HTTPS proxy.
func WithUserAgent ¶
func WithUserAgent(userAgent string) WebToolOption
WithUserAgent sets the User-Agent sent by fetchURL requests.