Class: Coatepec::MCP::SpecRunTool

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

Overview

The rails_spec_run MCP tool: runs targeted RSpec examples against the warm test worker and returns a structured pass/fail result.

Class Method Summary collapse

Class Method Details

.call(paths:, server_context:, example: nil, seed: nil, fail_fast: false, timeout_seconds: 120) ⇒ Object

rubocop:disable Metrics/ParameterLists -- mirrors the tool's own input_schema (paths/example/seed/fail_fast/timeout_seconds) plus the MCP-framework-injected server_context; splitting it would fight the ::MCP::Tool#call contract.



27
28
29
30
31
32
33
34
35
36
# File 'lib/coatepec/mcp/tools.rb', line 27

def call(paths:, server_context:, example: nil, seed: nil, fail_fast: false, timeout_seconds: 120)
  # rubocop:enable Metrics/ParameterLists
  started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  data = server_context[:worker_manager].run_spec(
    paths: paths, example: example, seed: seed, fail_fast: fail_fast, timeout_seconds: timeout_seconds
  )
  Response.ok(data: data, meta: meta_for(server_context, started_at))
rescue Coatepec::Error => e
  Response.error(e)
end