Class: Ask::Tools::WebFetch

Inherits:
Ask::Tool
  • Object
show all
Defined in:
lib/ask/web_fetch/tool.rb

Overview

The native agent tool for web fetch — the Ask::Tool framing of the library. Consumed WITHOUT MCP by agent frameworks (ask-agent's tool: :web_fetch, ask-app-server, llm-proxy) that resolve tools from the Ask::Tools registry. It is a pure adapter: the capability (chain, collapse, format) lives in Ask::WebFetch, and this file is loaded only when ask-tools is present (see lib/ask/web_fetch.rb), so the library itself never depends on it.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.backendsObject

Chain configuration delegates to the library — swap or extend backends here or via Ask::WebFetch.backends.



17
18
19
# File 'lib/ask/web_fetch/tool.rb', line 17

def self.backends
  Ask::WebFetch.backends
end

.backends=(chain) ⇒ Object



21
22
23
# File 'lib/ask/web_fetch/tool.rb', line 21

def self.backends=(chain)
  Ask::WebFetch.backends = chain
end

Instance Method Details

#execute(url:, max_chars: Ask::WebFetch::DEFAULT_MAX_CHARS) ⇒ Object



37
38
39
# File 'lib/ask/web_fetch/tool.rb', line 37

def execute(url:, max_chars: Ask::WebFetch::DEFAULT_MAX_CHARS)
  Ask::Result.ok(data: Ask::WebFetch.fetch(url, max_chars: max_chars))
end