Class: RailsAiBridge::Tools::GetView
- Defined in:
- lib/rails_ai_bridge/tools/get_view.rb,
lib/rails_ai_bridge/tools/get_view/base_formatter.rb,
lib/rails_ai_bridge/tools/get_view/full_formatter.rb,
lib/rails_ai_bridge/tools/get_view/summary_formatter.rb,
lib/rails_ai_bridge/tools/get_view/standard_formatter.rb,
lib/rails_ai_bridge/tools/get_view/specific_view_formatter.rb
Overview
Exposes view-layer context through MCP with compact listings and file-focused inspection for editing workflows.
Defined Under Namespace
Classes: BaseFormatter, FullFormatter, SpecificViewFormatter, StandardFormatter, SummaryFormatter
Class Method Summary collapse
-
.call(path: nil, controller: nil, partial: nil, detail: 'standard', _server_context: nil) ⇒ MCP::Tool::Response
Returns summarized or file-focused view context.
Methods inherited from BaseTool
cached_context, cached_section, config, rails_app, reset_cache!, text_response
Class Method Details
.call(path: nil, controller: nil, partial: nil, detail: 'standard', _server_context: nil) ⇒ MCP::Tool::Response
Returns summarized or file-focused view context.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rails_ai_bridge/tools/get_view.rb', line 44 def self.call(path: nil, controller: nil, partial: nil, detail: 'standard', _server_context: nil) data = cached_section(:views) return text_response('View introspection not available. Add :views to introspectors.') unless data return text_response("View introspection failed: #{data[:error]}") if data[:error] if path analysis = ViewFileAnalyzer.call(root: rails_app.root, relative_path: path) return text_response(SpecificViewFormatter.new.call(analysis)) end formatter = build_formatter(detail, data, controller, partial) text_response(formatter.call) rescue SecurityError => error text_response(error.) rescue Errno::ENOENT text_response("Path not found: #{path}") end |