Class: RailsAiContext::Tools::GetServicePattern
- Defined in:
- lib/rails_ai_context/tools/get_service_pattern.rb
Constant Summary
Constants inherited from BaseTool
BaseTool::SESSION_CONTEXT, BaseTool::SHARED_CACHE
Class Method Summary collapse
Methods inherited from BaseTool
abstract!, abstract?, cache_key, cached_context, config, extract_method_source_from_file, extract_method_source_from_string, find_closest_match, fuzzy_find_key, inherited, not_found_response, paginate, rails_app, registered_tools, reset_all_caches!, reset_cache!, session_queries, session_record, session_reset!, set_call_params, text_response
Class Method Details
.call(service: nil, detail: "standard", server_context: nil) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rails_ai_context/tools/get_service_pattern.rb', line 27 def self.call(service: nil, detail: "standard", server_context: nil) root = Rails.root.to_s services_dir = File.join(root, "app", "services") unless Dir.exist?(services_dir) return text_response("No app/services/ directory found. This app may not use the service objects pattern.") end service_files = Dir.glob(File.join(services_dir, "**", "*.rb")).sort if service_files.empty? return text_response("app/services/ directory exists but contains no Ruby files.") end if service return format_single_service(service, service_files, services_dir, root) end format_service_listing(service_files, services_dir, root, detail) end |