Class: Evilution::MCP::MutateTool

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

Defined Under Namespace

Modules: ConfigBuilder, ErrorPayload, OptionParser, ProgressStreamer, ReportTrimmer, SurvivedEnricher

Class Method Summary collapse

Class Method Details

.call(server_context:, files: [], verbosity: nil, **opts) ⇒ Object



126
127
128
129
130
131
132
133
134
135
136
# File 'lib/evilution/mcp/mutate_tool.rb', line 126

def call(server_context:, files: [], verbosity: nil, **opts)
  config = build_config(files, opts)
  on_result = build_progress_streamer(server_context, opts, config)
  summary = Evilution::Runner.new(config: config, on_result: on_result).call
  compact = build_compact_report(summary, verbosity, opts, config)

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