Class: Coatepec::MCP::ModelTool

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

Overview

The rails_model MCP tool: returns an ActiveRecord model's schema, associations, validators, and enums.

Class Method Summary collapse

Class Method Details

.call(name:, server_context:) ⇒ Object



122
123
124
125
126
127
128
# File 'lib/coatepec/mcp/tools.rb', line 122

def call(name:, server_context:)
  started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  data = server_context[:worker_manager].model(name: name)
  Response.ok(data: data, meta: meta_for(server_context, started_at))
rescue Coatepec::Error => e
  Response.error(e)
end