struct

Anthropic::WebFetchTool

Inherits JSON::Serializable < Anthropic::ServerTool < JSON::Serializable < Struct < Value < Object

Web fetch tool - allows Claude to fetch and read web pages

A server-side tool that enables Claude to retrieve content from URLs.

message = client.messages.create(
  model: Anthropic::Model::CLAUDE_SONNET_4_6,
  max_tokens: 4096,
  server_tools: [Anthropic::WebFetchTool.new],
  messages: [{role: "user", content: "Read the content at https://example.com"}]
)

Constructors

excluding(*domains : String) : self

Create a web fetch tool excluding specific domains

Source
limited_to(*domains : String) : self

Create a web fetch tool limited to specific domains

Source
new(pull : JSON::PullParser)

Web fetch tool - allows Claude to fetch and read web pages

A server-side tool that enables Claude to retrieve content from URLs.

message = client.messages.create(
  model: Anthropic::Model::CLAUDE_SONNET_4_6,
  max_tokens: 4096,
  server_tools: [Anthropic::WebFetchTool.new],
  messages: [{role: "user", content: "Read the content at https://example.com"}]
)
Source
new(allowed_callers : Array(String) | Nil = nil, cache_control : CacheControl | Nil = nil, defer_loading : Bool | Nil = nil, strict : Bool | Nil = nil, max_uses : Int32 | Nil = nil, allowed_domains : Array(String) | Nil = nil, blocked_domains : Array(String) | Nil = nil, max_content_tokens : Int32 | Nil = nil, citations : CitationConfig | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

allowed_callers
Source
allowed_domains

Optional: Limit fetching to specific domains

Source
blocked_domains

Optional: Exclude specific domains from fetching

Source
cache_control
Source
citations

Optional: Enable citations on fetched content

Source
defer_loading
Source
max_content_tokens

Optional: Maximum content tokens to return

Source
max_uses

Optional: Maximum number of fetches Claude can perform

Source
name
Source
strict
Source
type
Source