Class: RailsMcpInsight::Tools::ListModels

Inherits:
MCP::Tool
  • Object
show all
Defined in:
lib/rails_mcp_insight/tools/list_models.rb

Class Method Summary collapse

Class Method Details

.call(server_context:) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/rails_mcp_insight/tools/list_models.rb', line 15

def self.call(server_context:)
  config = Configuration.new(project_path: server_context&.dig(:project_path) || Dir.pwd)
  analyzer = Analyzers::ModelAnalyzer.new(config)
  models = analyzer.list_all

  MCP::Tool::Response.new([{ type: "text",
                             text: JSON.pretty_generate({ total: models.length, models: models }) }])
end