Class: Coatepec::MCP::RuntimeStatusTool

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

Overview

The rails_runtime_status MCP tool: reports the test worker's Ruby/Rails versions, PID, boot_id, and lifecycle state. Worker::Server#handle boots the Rails runtime before dispatching any command, so the first call to this tool starts (and blocks on) a full Rails boot just like a spec run.

Class Method Summary collapse

Class Method Details

.call(server_context:) ⇒ Object



59
60
61
62
63
64
65
66
67
68
# File 'lib/coatepec/mcp/tools.rb', line 59

def call(server_context:)
  started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  data = server_context[:worker_manager].status
  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