Class: RailsMcpInsight::Tools::SearchCode
- Inherits:
-
MCP::Tool
- Object
- MCP::Tool
- RailsMcpInsight::Tools::SearchCode
- Defined in:
- lib/rails_mcp_insight/tools/search_code.rb
Class Method Summary collapse
Class Method Details
.call(query:, server_context:, file_pattern: "*.rb", context_lines: 2) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/rails_mcp_insight/tools/search_code.rb', line 22 def self.call(query:, server_context:, file_pattern: "*.rb", context_lines: 2) config = Configuration.new(project_path: server_context&.dig(:project_path) || Dir.pwd) searcher = Analyzers::CodeSearcher.new(config) result = searcher.search(query: query, file_pattern: file_pattern, context_lines: context_lines) MCP::Tool::Response.new([{ type: "text", text: JSON.pretty_generate(result) }]) end |