Class: Coatepec::MCP::RuntimeRestartTool

Inherits:
MCP::Tool
  • Object
show all
Defined in:
lib/coatepec/mcp/tools.rb

Overview

The rails_runtime_restart MCP tool: unconditionally tears down and respawns the test worker, discarding its warm Rails boot. A manual escape hatch alongside WorkerManager's own automatic dead-worker detection, for whatever failure mode that detection doesn't catch.

Class Method Summary collapse

Class Method Details

.call(server_context:) ⇒ Object



84
85
86
87
88
89
90
91
92
93
# File 'lib/coatepec/mcp/tools.rb', line 84

def call(server_context:)
  started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  data = server_context[:worker_manager].restart!
  duration_ms = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - started_at) * 1000).round
  Response.ok(data: data,
              meta: { project_root: server_context[:project_root], environment: "test",
                      duration_ms: duration_ms })
rescue Coatepec::Error => e
  Response.error(e)
end