Class: Phlex::Reactive::MCP::Tools::ConfigTool

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/phlex/reactive/mcp/tools/config_tool.rb

Overview

phlex_reactive_config — a REDACTED config summary. It reports the page-stable, non-secret configuration a developer needs to understand the install, and NEVER the verifier, secret_key_base, or any token. The allowlist below is explicit: a field is reported only if it appears here.

Class Method Summary collapse

Methods inherited from BaseTool

annotations_value, eager_load_app!, error_response, json_response

Class Method Details

.call(server_context: nil) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/phlex/reactive/mcp/tools/config_tool.rb', line 24

def self.call(server_context: nil) # rubocop:disable Lint/UnusedMethodArgument
  json_response(
    version: Phlex::Reactive::VERSION,
    action_path: Phlex::Reactive.action_path,
    base_controller_name: Phlex::Reactive.base_controller_name,
    renderer: renderer_name,
    verify_authorized: Phlex::Reactive.verify_authorized,
    authorization_methods: Phlex::Reactive.authorization_methods,
    authorization_errors: Phlex::Reactive.authorization_errors.map(&:to_s),
    verbose_errors: Phlex::Reactive.verbose_errors,
    debug: Phlex::Reactive.debug,
    log_events: Phlex::Reactive.log_events,
    flash_target: Phlex::Reactive.flash_target,
    pgbus: pgbus?,
    pgbus_streams: pgbus_streams?
  )
end

.pgbus?Boolean

Is pgbus present and stream-capable? Delegates to the config readers when they exist; otherwise probes directly (defined? + respond_to?), so the report is correct regardless of pgbus version. Delegate to the gem's own capability gates (issue #165) — the canonical runtime probes (pgbus_streams? inspects Pgbus::Streams::Stream#broadcast's parameters directly, never a live stream call). Reported as plain booleans; degrade to false if the readers ever raise.

Returns:

  • (Boolean)


59
60
61
62
63
# File 'lib/phlex/reactive/mcp/tools/config_tool.rb', line 59

def self.pgbus?
  !!Phlex::Reactive.pgbus?
rescue StandardError
  false
end

.pgbus_streams?Boolean

Returns:

  • (Boolean)


65
66
67
68
69
# File 'lib/phlex/reactive/mcp/tools/config_tool.rb', line 65

def self.pgbus_streams?
  !!Phlex::Reactive.pgbus_streams?
rescue StandardError
  false
end

.renderer_nameObject

The renderer is a controller CLASS (or nil) — report its name, never the object (which could inspect to something with state).



44
45
46
47
48
49
# File 'lib/phlex/reactive/mcp/tools/config_tool.rb', line 44

def self.renderer_name
  renderer = Phlex::Reactive.renderer
  renderer.respond_to?(:name) ? renderer.name : renderer.class.name
rescue StandardError
  nil
end