Class: Evilution::MCP::InfoTool Private

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

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

Constant Summary collapse

VALID_ACTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/evilution/mcp/info_tool.rb', line 75

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 = nil
  line_ranges = nil
  if files
    parsed = RequestParser.parse_files(Array(files))
    parsed_files = parsed.files
    line_ranges = parsed.ranges
  end

  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