Class: RailsAiBridge::Tools::GetModelDetails
- Defined in:
- lib/rails_ai_bridge/tools/get_model_details.rb
Overview
MCP tool returning ActiveRecord model metadata, optional non-AR +app/models+ listings, and configurable list detail for all models.
Class Method Summary collapse
-
.call(model: nil, detail: 'standard', _server_context: nil) ⇒ MCP::Tool::Response
Returns Markdown for one model or for a full listing.
Methods inherited from BaseTool
cached_context, cached_section, config, rails_app, reset_cache!, text_response
Class Method Details
.call(model: nil, detail: 'standard', _server_context: nil) ⇒ MCP::Tool::Response
Returns Markdown for one model or for a full listing.
Reads +:models+ and, when present, +:non_ar_models+ from BaseTool.cached_section. When +model+ matches a non-AR entry and not an ActiveRecord key, returns a short POJO summary.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rails_ai_bridge/tools/get_model_details.rb', line 40 def self.call(model: nil, detail: 'standard', _server_context: nil) models = cached_section(:models) return text_response('Model introspection not available. Add :models to introspectors.') unless models return text_response("Model introspection failed: #{models[:error]}") if models[:error] non_ar = cached_section(:non_ar_models) formatter = ResponseFormatter.new(models, model: model, detail: detail, non_ar_models: non_ar) return text_response(formatter.) if formatter.model_not_found? return text_response(formatter.) if formatter.model_error? text_response(formatter.format) end |