Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Tool = tools.DefineTool("web_fetch", "Fetch a URL and return its text content. Automatically uses a headless browser if the page appears to be a JavaScript SPA.", map[string]any{ "type": "object", "properties": map[string]any{ "url": map[string]any{"type": "string", "description": "URL to fetch (https:// or http://)"}, "max_size": map[string]any{"type": "integer", "description": "Maximum bytes to return (default: 100000, max: 500000)"}, }, "required": []string{"url"}, }, func(ctx context.Context, p WebFetchParams) (string, error) { if err := validateAndClampURL(p.URL, &p.MaxSize); err != nil { return "", err } result, err := fetchHTTP(ctx, p.URL, p.MaxSize) if err != nil { return "", err } if looksLikeSPAShell(result) { rendered, err := renderJS(ctx, p.URL, p.MaxSize) if err != nil { return result, nil } return rendered, nil } return result, nil }, )
Functions ¶
func CloseBrowser ¶
func CloseBrowser()
Types ¶
type WebFetchParams ¶
Click to show internal directories.
Click to hide internal directories.