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



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/evilution/mcp/mutate_tool.rb', line 107

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