Documentation
¶
Index ¶
Constants ¶
const (
ToolNameFetch = "fetch"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
func NewFetchTool ¶
func NewFetchTool(options ...ToolOption) *Tool
func (*Tool) Instructions ¶
type ToolOption ¶
type ToolOption func(*Tool)
func WithAllowPrivateIPs ¶
func WithAllowPrivateIPs(allow bool) ToolOption
WithAllowPrivateIPs controls whether the fetch tool may dial non-public IP addresses (loopback, RFC1918, link-local incl. cloud metadata at 169.254.169.254, multicast and the unspecified address). The default is false: such addresses are refused at dial time, after DNS resolution, so DNS rebinding cannot bypass the check. Set to true only when an agent legitimately needs to reach internal services.
func WithAllowedDomains ¶
func WithAllowedDomains(domains []string) ToolOption
WithAllowedDomains restricts the fetch tool to URLs whose host matches one of the supplied domain patterns. See matchesDomain for matching rules. An empty or nil slice disables the allow-list (every host is allowed).
func WithBlockedDomains ¶
func WithBlockedDomains(domains []string) ToolOption
WithBlockedDomains forbids the fetch tool from fetching URLs whose host matches one of the supplied domain patterns. See matchesDomain for matching rules. An empty or nil slice disables the deny-list.
func WithHeaders ¶
func WithHeaders(headers map[string]string) ToolOption
WithHeaders sets static HTTP headers attached to every fetch request. Typical use is supplying credentials such as `Authorization: Bearer ...`. These are applied last, so they override the default User-Agent and the format-driven Accept header. An empty or nil map is a no-op.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ToolOption