Class: RailsAiContext::Tools::SessionContext
- Defined in:
- lib/rails_ai_context/tools/session_context.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(action: nil, mark: nil, server_context: nil) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rails_ai_context/tools/session_context.rb', line 28 def self.call(action: nil, mark: nil, server_context: nil) unless action || mark return text_response("Provide `action` (status/summary/reset) or `mark` (tool:param to record).") end if mark tool, params = parse_mark(mark) session_record(tool, params) return text_response("Marked `#{tool}` with params `#{params}` as queried.") end case action when "status" render_status when "summary" render_summary when "reset" session_reset! text_response("Session cleared. All query records removed.") else text_response("Unknown action: #{action}. Use status, summary, or reset.") end rescue => e text_response("Session context error: #{e.}") end |