Class: Tools::WebGet
Overview
Fetches content from a URL via HTTP GET. Returns a structured result with the response body and Content-Type header so that ToolDecorator can apply format-specific conversion (HTML → Markdown, JSON → TOON, etc.).
The body is truncated to Anima::Settings.max_web_response_bytes before decoration to cap memory usage on large responses.
Only http and https schemes are allowed.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#initialize, schema, truncation_threshold
Constructor Details
This class inherits a constructor from Tools::Base
Class Method Details
.description ⇒ Object
18 |
# File 'lib/tools/web_get.rb', line 18 def self.description = "Fetch a URL." |
.input_schema ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/tools/web_get.rb', line 20 def self.input_schema { type: "object", properties: { url: {type: "string"} }, required: ["url"] } end |
.tool_name ⇒ Object
16 |
# File 'lib/tools/web_get.rb', line 16 def self.tool_name = "web_get" |
Instance Method Details
#execute(input) ⇒ Hash
35 36 37 |
# File 'lib/tools/web_get.rb', line 35 def execute(input) validate_and_fetch(input["url"].to_s, timeout: input["timeout"]) end |