Class: RailsMcpInsight::Tools::AnalyzeMigrationHistory

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

Class Method Summary collapse

Class Method Details

.call(server_context:, table: nil) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/rails_mcp_insight/tools/analyze_migration_history.rb', line 20

def self.call(server_context:, table: nil)
  config = Configuration.new(project_path: server_context&.dig(:project_path) || Dir.pwd)
  analyzer = Analyzers::MigrationAnalyzer.new(config)
  results = analyzer.analyze(table_name: table)

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