Module: RailsActiveMcp
- Defined in:
- lib/rails_active_mcp.rb,
lib/rails_active_mcp/engine.rb,
lib/rails_active_mcp/version.rb,
lib/rails_active_mcp/sdk/server.rb,
lib/rails_active_mcp/configuration.rb,
lib/rails_active_mcp/safety_checker.rb,
lib/rails_active_mcp/console_executor.rb,
lib/rails_active_mcp/sdk/tools/dry_run_tool.rb,
lib/rails_active_mcp/garbage_collection_utils.rb,
lib/rails_active_mcp/sdk/tools/model_info_tool.rb,
lib/rails_active_mcp/sdk/tools/safe_query_tool.rb,
lib/rails_active_mcp/sdk/tools/console_execute_tool.rb,
lib/generators/rails_active_mcp/install/install_generator.rb
Defined Under Namespace
Modules: ConsoleMethods, Generators, Sdk Classes: Configuration, ConsoleExecutor, Engine, Error, ExecutionError, GarbageCollectionUtils, SafetyChecker, SafetyError, TimeoutError
Constant Summary collapse
- VERSION =
'3.2.0'
Class Attribute Summary collapse
-
.configuration ⇒ Object
Returns the value of attribute configuration.
-
.logger ⇒ Object
Logger accessor - configured by engine or defaults to stderr.
Class Method Summary collapse
- .config ⇒ Object
- .configure {|configuration| ... } ⇒ Object
-
.execute(code) ⇒ Object
Quick execution method.
-
.safe?(code) ⇒ Boolean
Quick access to safety checker.
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
23 24 25 |
# File 'lib/rails_active_mcp.rb', line 23 def configuration @configuration end |
.logger ⇒ Object
Logger accessor - configured by engine or defaults to stderr
46 47 48 49 50 51 52 53 |
# File 'lib/rails_active_mcp.rb', line 46 def logger @logger ||= Logger.new($stderr).tap do |logger| logger.level = Logger::INFO logger.formatter = proc do |severity, datetime, _progname, msg| "[#{datetime}] #{severity} -- RailsActiveMcp: #{msg}\n" end end end |
Class Method Details
.config ⇒ Object
31 32 33 |
# File 'lib/rails_active_mcp.rb', line 31 def config configuration || configure end |
.configure {|configuration| ... } ⇒ Object
25 26 27 28 29 |
# File 'lib/rails_active_mcp.rb', line 25 def configure self.configuration ||= Configuration.new yield(configuration) if block_given? configuration end |
.execute(code) ⇒ Object
Quick execution method
41 42 43 |
# File 'lib/rails_active_mcp.rb', line 41 def execute(code, **) ConsoleExecutor.new(config).execute(code, **) end |
.safe?(code) ⇒ Boolean
Quick access to safety checker
36 37 38 |
# File 'lib/rails_active_mcp.rb', line 36 def safe?(code) SafetyChecker.new(config).safe?(code) end |