Class: Phlex::Reactive::MCP::Tools::FindTool
- Defined in:
- lib/phlex/reactive/mcp/tools/find_tool.rb
Overview
phlex_reactive_find — fuzzy-search components by name and return the ranked matches, each with full per-action detail INCLUDING the Prism- extracted method definition source. The tool for "where is X defined and what does its action do?".
Class Method Summary collapse
- .action_detail(action) ⇒ Object
-
.call(query:, server_context: nil) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument.
- .match_hash(info) ⇒ Object
Methods inherited from BaseTool
annotations_value, eager_load_app!, error_response, json_response
Class Method Details
.action_detail(action) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/phlex/reactive/mcp/tools/find_tool.rb', line 50 def self.action_detail(action) { name: action.name, params: action.params, source_location: Phlex::Reactive::Inspector::Report.location_str(action.source_location), authorization_call_detected: action., # The full method SOURCE — this is the one field that exposes an # action body verbatim (see the tool description). A secret hardcoded # in an action would surface here; keep secrets out of action bodies. definition: action.definition } end |
.call(query:, server_context: nil) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
34 35 36 37 38 |
# File 'lib/phlex/reactive/mcp/tools/find_tool.rb', line 34 def self.call(query:, server_context: nil) # rubocop:disable Lint/UnusedMethodArgument eager_load_app! matches = Phlex::Reactive::Inspector.find(query).map { match_hash(it) } json_response(query: query, matches: matches) end |
.match_hash(info) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/phlex/reactive/mcp/tools/find_tool.rb', line 40 def self.match_hash(info) { name: info.name, path: Phlex::Reactive::Inspector::Report.location_str(info.path), record_key: info.record_key, state_keys: info.state_keys, actions: info.actions.map { action_detail(it) } } end |