Class: RailsAiContext::Tools::GetFrontendStack

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/rails_ai_context/tools/get_frontend_stack.rb

Constant Summary

Constants inherited from BaseTool

BaseTool::SESSION_CONTEXT, BaseTool::SHARED_CACHE

Class Method Summary collapse

Methods inherited from BaseTool

abstract!, abstract?, cache_key, cached_context, config, extract_method_source_from_file, extract_method_source_from_string, find_closest_match, fuzzy_find_key, inherited, not_found_response, paginate, rails_app, registered_tools, reset_all_caches!, reset_cache!, session_queries, session_record, session_reset!, set_call_params, text_response

Class Method Details

.call(detail: "standard", server_context: nil) ⇒ Object

rubocop:disable Metrics



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rails_ai_context/tools/get_frontend_stack.rb', line 24

def self.call(detail: "standard", server_context: nil) # rubocop:disable Metrics
  data = cached_context[:frontend_frameworks]

  unless data.is_a?(Hash) && !data[:error]
    return text_response(
      "No frontend framework data available. Ensure the :frontend_frameworks introspector is enabled in your " \
      "rails_ai_context configuration.\n\n" \
      "Example:\n```ruby\nRailsAiContext.configure do |config|\n  config.introspectors << :frontend_frameworks\nend\n```"
    )
  end

  case detail
  when "summary"
    text_response(build_summary(data))
  when "standard"
    text_response(build_standard(data))
  when "full"
    text_response(build_full(data))
  else
    text_response("Unknown detail level: #{detail}. Use summary, standard, or full.")
  end
end