Class: Assistant::SeoInspectUrlToolBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/services/assistant/seo_inspect_url_tool_builder.rb

Overview

Builds the seo_inspect_url RubyLLM::Tool: technical-SEO inspection of any
public URL via Heatwave::Crawler :inspect mode (headless-browser load,
artifacts from the rendered DOM).

Split out of SeoToolBuilder — that class is already over its
Metrics/ClassLength budget, so new tools get their own builders.

Usage (via ChatToolBuilder):
tools = Assistant::SeoInspectUrlToolBuilder.tools

Constant Summary collapse

DESCRIPTION =
"[SEO Audit] Load a URL in a real headless browser and return technical SEO findings " \
"from the RENDERED page: final URL after redirects, HTTP status, title, meta description, " \
"canonical, robots, hreflang, H1s, JSON-LD schema types, JS console errors, and failed " \
"network requests. Works for any public URL — our own site or a competitor. " \
"Use for technical SEO checks, validating rendered meta/schema (catches JS-injected " \
"tags that raw HTML misses), or pages whose content only appears after JS runs. " \
"For simply reading a page's text content, use the fetch_url tool instead."
PARAMS =
{
  type: 'object',
  properties: {
    url: {
      type: 'string',
      description: 'The full URL to inspect, including protocol (e.g. "https://example.com/page")'
    },
    capture_screenshot: {
      type: 'boolean',
      description: 'Also capture a full-page screenshot and return its file path (default: false)'
    }
  },
  required: ['url']
}.freeze

Class Method Summary collapse

Class Method Details

.toolsObject



39
40
41
42
43
44
# File 'app/services/assistant/seo_inspect_url_tool_builder.rb', line 39

def tools
  @tools ||= [build_tool]
rescue StandardError => e
  Rails.logger.warn("[SeoInspectUrlToolBuilder] Failed to build tool: #{e.message}")
  []
end