View Source Anthropic.Tools.WebFetch (anthropic_community v0.5.0)

Builds the web fetch server tool definition. Pass the result inside the :tools list to Anthropic.Messages.create/2 — Claude fetches the URL server-side and the result comes back as a %Anthropic.Messages.Content.WebFetchToolResult{} block; no client-side execute/1 needed.

Examples

Anthropic.Messages.create(client,
  model: "claude-opus-4-8",
  max_tokens: 1024,
  tools: [Anthropic.Tools.WebFetch.new(max_uses: 3)],
  messages: [%{role: "user", content: "Summarize https://example.com/article"}]
)

Summary

Functions

Options

  • :version (String.t/0) - The tool's versioned type string. Override to pin an older API version. The default value is "web_fetch_20260318".

Functions

@spec new(keyword()) :: map()

Options

  • :version (String.t/0) - The tool's versioned type string. Override to pin an older API version. The default value is "web_fetch_20260318".

  • :max_uses (pos_integer/0) - Maximum number of fetches Claude can perform in this request.

  • :max_content_tokens (pos_integer/0) - Approximate cap on tokens used by fetched page content.

  • :allowed_domains (list of String.t/0) - Only these domains may be fetched.

  • :blocked_domains (list of String.t/0) - These domains may never be fetched.

  • :citations (map/0) - Citations config for fetched documents, e.g. %{enabled: true}. Disabled by default.

  • :cache_control (map/0) - An Anthropic.CacheControl map.