Class: RailsMcpServer::Analyzers::AnalyzeModels

Inherits:
BaseAnalyzer
  • Object
show all
Defined in:
lib/rails-mcp-server/analyzers/analyze_models.rb

Instance Method Summary collapse

Instance Method Details

#call(model_name: nil, model_names: nil, detail_level: "full", analysis_type: "introspection") ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rails-mcp-server/analyzers/analyze_models.rb', line 4

def call(model_name: nil, model_names: nil, detail_level: "full", analysis_type: "introspection")
  unless current_project
    return "No active project. Please switch to a project first."
  end

  detail_level = "full" unless %w[names associations full].include?(detail_level)
  analysis_type = "introspection" unless %w[introspection static full].include?(analysis_type)

  if model_names&.is_a?(Array) && model_names.any?
    return batch_model_info(model_names, detail_level, analysis_type)
  end

  if model_name
    return single_model_info(model_name, detail_level, analysis_type)
  end

  list_all_models(detail_level)
end