Class: DebugMcp::Tools::ListPausedSessions

Inherits:
MCP::Tool
  • Object
show all
Defined in:
lib/debug_mcp/tools/list_paused_sessions.rb

Class Method Summary collapse

Class Method Details

.call(server_context:) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/debug_mcp/tools/list_paused_sessions.rb', line 23

def call(server_context:)
  manager = server_context[:session_manager]
  sessions = manager.active_sessions(include_client: true)

  if sessions.empty?
    text = "No active debug sessions. Use 'connect' or 'run_script' to start one."
  else
    lines = sessions.map { |s| format_session(s) }
    text = "Active debug sessions:\n#{lines.join("\n")}"
    text += "\n\nNote: Sessions expire after inactivity. Any tool call resets the timer."
  end

  MCP::Tool::Response.new([{ type: "text", text: text }])
end