Class: RailsAiBridge::Tools::GetConventions

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/rails_ai_bridge/tools/get_conventions.rb

Overview

MCP tool exposing detected architecture, patterns, directory layout, and config files.

Class Method Summary collapse

Methods inherited from BaseTool

cached_context, cached_section, config, rails_app, reset_cache!, text_response

Class Method Details

.call(_server_context: nil) ⇒ MCP::Tool::Response

Returns markdown convention summary or an error message.

Parameters:

  • _server_context (Object, nil) (defaults to: nil)

    reserved for MCP transport metadata (unused)

Returns:

  • (MCP::Tool::Response)

    markdown convention summary or an error message



17
18
19
20
21
22
23
24
# File 'lib/rails_ai_bridge/tools/get_conventions.rb', line 17

def self.call(_server_context: nil)
  conventions = cached_section(:conventions)
  return text_response('Convention detection not available. Add :conventions to introspectors.') unless conventions
  return text_response("Convention detection failed: #{conventions[:error]}") if conventions[:error]

  formatter = ResponseFormatter.new(conventions)
  text_response(formatter.format)
end