Class: Phlex::Reactive::MCP::Tools::ComponentsTool

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

Overview

phlex_reactive_components — a summary of every constant-backed reactive component: name, source path, action count, record/state keys. The bird's-eye inventory; phlex_reactive_actions has the per-action detail.

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



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/phlex/reactive/mcp/tools/components_tool.rb', line 22

def self.call(server_context: nil) # rubocop:disable Lint/UnusedMethodArgument
  eager_load_app!
  components = Phlex::Reactive::Inspector.components.map do
    {
      name: it.name,
      path: Phlex::Reactive::Inspector::Report.location_str(it.path),
      action_count: it.actions.length,
      record_key: it.record_key,
      state_keys: it.state_keys
    }
  end
  json_response(components: components)
end