Skip to main content

Interface: WebFetchToolOptions

Defined in: packages/tools/src/web/web-fetch.ts:458

Extends​

Properties​

allowedHosts?​

optional allowedHosts?: string[]

Defined in: packages/tools/src/web/web-fetch.ts:141

Only these hosts (exact, or .example.com for a domain and its subdomains).

Inherited from​

ReadWebPageOptions.allowedHosts


allowPrivateNetworks?​

optional allowPrivateNetworks?: boolean

Defined in: packages/tools/src/web/web-fetch.ts:145

Allow localhost and private ranges. Default false.

Inherited from​

ReadWebPageOptions.allowPrivateNetworks


blockedHosts?​

optional blockedHosts?: string[]

Defined in: packages/tools/src/web/web-fetch.ts:143

Never these hosts (same matching).

Inherited from​

ReadWebPageOptions.blockedHosts


content?​

optional content?: "main" | "full"

Defined in: packages/tools/src/web/web-fetch.ts:468

The model may ask for content: 'main' (the article body) or 'full' per call; this is what it gets when it does not say. Default full.

Overrides​

ReadWebPageOptions.content


description?​

optional description?: string

Defined in: packages/tools/src/web/web-fetch.ts:461


fallback?​

optional fallback?: (request) => Promise<WebFallbackPage | null | undefined>

Defined in: packages/tools/src/web/web-fetch.ts:157

Read a page the plain read could not. Return null to keep the plain outcome.

Parameters​

request​

WebFallbackRequest

Returns​

Promise<WebFallbackPage | null | undefined>

Inherited from​

ReadWebPageOptions.fallback


fetch?​

optional fetch?: {(input, init?): Promise<Response>; (input, init?): Promise<Response>; }

Defined in: packages/tools/src/web/web-fetch.ts:151

The platform fetch, when there is no transport.

Call Signature​

(input, init?): Promise<Response>

MDN Reference

Parameters​
input​

URL | RequestInfo

init?​

RequestInit

Returns​

Promise<Response>

Call Signature​

(input, init?): Promise<Response>

MDN Reference

Parameters​
input​

string | URL | Request

init?​

RequestInit

Returns​

Promise<Response>

Inherited from​

ReadWebPageOptions.fetch


maxBytes?​

optional maxBytes?: number

Defined in: packages/tools/src/web/web-fetch.ts:137

Bytes downloaded at most. Default 5 MB.

Inherited from​

ReadWebPageOptions.maxBytes


maxChars?​

optional maxChars?: number

Defined in: packages/tools/src/web/web-fetch.ts:463

Characters of text returned per call. Default 20,000.


name?​

optional name?: string

Defined in: packages/tools/src/web/web-fetch.ts:460

Tool name. Default web_fetch.


onPage?​

optional onPage?: (page, read) => void | Record<string, unknown> | Promise<void | Record<string, unknown>>

Defined in: packages/tools/src/web/web-fetch.ts:477

The whole page, raw HTML and original bytes included, on every read (the model may read a long page in several parts; offset says which). Save the original here. Fields you return are added to what the model sees (e.g. { saved_as: 'doc_123' }).

Parameters​

page​

WebPage

read​
offset​

number

Returns​

void | Record<string, unknown> | Promise<void | Record<string, unknown>>


readPdf?​

optional readPdf?: false | PdfTextReader

Defined in: packages/tools/src/web/web-fetch.ts:155

Read a PDF's text layer. Default: unpdf when installed. false: keep the bytes, read no text.

Inherited from​

ReadWebPageOptions.readPdf


resolveHost?​

optional resolveHost?: (hostname) => Promise<string[]>

Defined in: packages/tools/src/web/web-fetch.ts:149

Unpinned: check a hostname's addresses before the platform fetch resolves it again.

Parameters​

hostname​

string

Returns​

Promise<string[]>

Inherited from​

ReadWebPageOptions.resolveHost


structuredDataChars?​

optional structuredDataChars?: number

Defined in: packages/tools/src/web/web-fetch.ts:470

Characters of JSON-LD the model sees, whole blocks only. Default 8,000; 0 leaves it out.


thinChars?​

optional thinChars?: number

Defined in: packages/tools/src/web/web-fetch.ts:159

An HTML page with less readable text than this is thin. Default 200 characters.

Inherited from​

ReadWebPageOptions.thinChars


timeoutMs?​

optional timeoutMs?: number

Defined in: packages/tools/src/web/web-fetch.ts:139

One deadline for the whole read, redirects and body included. Default 20 s.

Inherited from​

ReadWebPageOptions.timeoutMs


transport?​

optional transport?: WebFetchTransport

Defined in: packages/tools/src/web/web-fetch.ts:147

Pinned resolution and connection (see WebFetchTransport). Wins over fetch and resolveHost.

Inherited from​

ReadWebPageOptions.transport


userAgent?​

optional userAgent?: string

Defined in: packages/tools/src/web/web-fetch.ts:153

Sent as User-Agent.

Inherited from​

ReadWebPageOptions.userAgent