Class: Evilution::MCP::InfoTool

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

Defined Under Namespace

Modules: Actions, ConfigFactory, ErrorMapper, RequestParser, ResponseFormatter, StatusGlossary

Constant Summary collapse

VALID_ACTIONS =
%w[subjects tests environment statuses feedback].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



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/evilution/mcp/info_tool.rb', line 74

def call(server_context:, action: nil, files: nil, target: nil, spec: nil, integration: nil, skip_config: nil)
  return ResponseFormatter.error("config_error", "action is required") unless action
  return ResponseFormatter.error("config_error", "unknown action: #{action}") unless ACTIONS.key?(action)

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

  ACTIONS[action].call(
    files: parsed_files, line_ranges: line_ranges, target: target, spec: spec,
    integration: integration, skip_config: skip_config
  )
rescue Evilution::Error => e
  ResponseFormatter.error_for(e)
end