Class: Evilution::MCP::InfoTool

Inherits:
MCP::Tool
  • Object
show all
Defined in:
lib/evilution/mcp/info_tool.rb

Constant Summary collapse

VALID_ACTIONS =
%w[subjects tests environment].freeze

Class Method Summary collapse

Class Method Details

.call(server_context:, action: nil, files: nil, target: nil, spec: nil, integration: nil, skip_config: nil) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/evilution/mcp/info_tool.rb', line 67

def call(server_context:, action: nil, files: nil, target: nil, spec: nil, integration: nil, skip_config: nil)
  return error_response("config_error", "action is required") unless action
  return error_response("config_error", "unknown action: #{action}") unless VALID_ACTIONS.include?(action)

  parsed_files, line_ranges = parse_files(Array(files)) if files

  case action
  when "subjects"
    subjects_action(files: parsed_files, line_ranges: line_ranges, target: target,
                    integration: integration, skip_config: skip_config)
  when "tests"
    tests_action(files: parsed_files, spec: spec, integration: integration, skip_config: skip_config)
  when "environment"
    environment_action
  end
rescue Evilution::Error => e
  error_response_for(e)
end