Class: RailsAiBridge::Tools::GetConfig

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

Overview

MCP tool exposing application configuration (cache, session, timezone, middleware, initializers).

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 configuration summary or an error message.

Parameters:

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

    reserved for MCP transport metadata (unused)

Returns:

  • (MCP::Tool::Response)

    markdown configuration summary or an error message



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

def self.call(_server_context: nil)
  data = cached_section(:config)
  return text_response('Config introspection not available. Add :config to introspectors or use `config.preset = :full`.') unless data
  return text_response("Config introspection failed: #{data[:error]}") if data[:error]

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