Class: Girb::Tools::DebugSessionHistoryTool

Inherits:
Base
  • Object
show all
Defined in:
lib/girb/tools/debug_session_history_tool.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

to_gemini_tool, tool_name

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/girb/tools/debug_session_history_tool.rb', line 39

def available?
  defined?(DEBUGGER__)
end

.descriptionObject



16
17
18
19
# File 'lib/girb/tools/debug_session_history_tool.rb', line 16

def description
  "Get session history including AI conversations from previous sessions (if persisted) and current session commands. " \
  "Use this to recall past conversations and debug commands."
end

.nameObject



12
13
14
# File 'lib/girb/tools/debug_session_history_tool.rb', line 12

def name
  "get_session_history"
end

.parametersObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/girb/tools/debug_session_history_tool.rb', line 21

def parameters
  {
    type: "object",
    properties: {
      action: {
        type: "string",
        enum: %w[full_history list_ai_conversations],
        description: "Action: full_history (all commands and AI conversations), list_ai_conversations (AI Q&A only)"
      },
      count: {
        type: "integer",
        description: "Number of recent entries to retrieve (default: 20)"
      }
    },
    required: ["action"]
  }
end

Instance Method Details

#execute(_binding, action:, count: 20) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/girb/tools/debug_session_history_tool.rb', line 44

def execute(_binding, action:, count: 20)
  case action
  when "full_history"
    get_full_history(count)
  when "list_ai_conversations"
    list_ai_conversations(count)
  else
    { error: "Unknown action: #{action}. Use 'full_history' or 'list_ai_conversations'." }
  end
rescue StandardError => e
  { error: "#{e.class}: #{e.message}" }
end