Class: RailsMcpInsight::Tools::FindTests

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

Class Method Summary collapse

Class Method Details

.call(file:, server_context:) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/rails_mcp_insight/tools/find_tests.rb', line 21

def self.call(file:, server_context:)
  config = Configuration.new(project_path: server_context&.dig(:project_path) || Dir.pwd)
  analyzer = Analyzers::TestAnalyzer.new(config)

  full_path = File.expand_path(file, config.project_path)
  result = analyzer.find_tests(full_path)

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