UrlFetcher

object UrlFetcher : CodBi

UrlFetcher — Lightweight HTML-to-text extractor

Fetches a URL and extracts readable text content from HTML pages. Used by the AI model via CALL:fetch(url='...') markers to read web page content when search result snippets are insufficient.

Domains to whitelist

  • Any domain the user or search results reference (outgoing HTTPS GET only)

Security

  • Only http and https schemes are allowed (no file:, ftp:, data:, etc.)

  • Private/internal IP ranges are blocked to prevent SSRF

  • Response size is capped at MAX_BODY_BYTES to prevent memory exhaustion

  • Output text is truncated to MAX_TEXT_CHARS to fit model context windows

Types

Link copied to clipboard
data class FetchResult(val url: String, val title: String? = null, val text: String? = null, val error: String? = null)

A fetched web page result.

Properties

Link copied to clipboard

Matches CALL:fetch(url='...') or CALL:fetch(url="...") in model output.

Functions

Link copied to clipboard

Fetches a URL and extracts readable text content.

Link copied to clipboard

Formats a fetch result into a text block suitable for injecting into a conversation.