Class: Evilution::MCP::MutateTool

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

Overview

rubocop:disable Metrics/ClassLength

Constant Summary collapse

VALID_VERBOSITIES =
%w[full summary minimal].freeze

Class Method Summary collapse

Class Method Details

.call(server_context:, files: [], target: nil, timeout: nil, jobs: nil, fail_fast: nil, spec: nil, verbosity: nil) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/evilution/mcp/mutate_tool.rb', line 53

def call(server_context:, files: [], target: nil, timeout: nil, jobs: nil, fail_fast: nil, spec: nil, verbosity: nil) # rubocop:disable Lint/UnusedMethodArgument
  parsed_files, line_ranges = parse_files(Array(files))
  config_opts = build_config_opts(parsed_files, line_ranges, target, timeout, jobs, fail_fast, spec)
  config = Config.new(**config_opts)
  runner = Runner.new(config: config)
  summary = runner.call
  report = Reporter::JSON.new.call(summary)
  compact = trim_report(report, normalize_verbosity(verbosity))

  ::MCP::Tool::Response.new([{ type: "text", text: compact }])
rescue Evilution::Error => e
  error_payload = build_error_payload(e)
  ::MCP::Tool::Response.new([{ type: "text", text: ::JSON.generate(error_payload) }], error: true)
end