Class: DebugMcp::Tools::RunDebugCommand

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

Class Method Summary collapse

Class Method Details

.call(command:, session_id: nil, server_context:) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/debug_mcp/tools/run_debug_command.rb', line 36

def call(command:, session_id: nil, server_context:)
  manager = server_context[:session_manager]
  client = manager.client(session_id)
  client.auto_repause!

  output = client.send_command(command)

  # Track catch breakpoints for preservation across sessions
  if command.strip =~ /\Acatch\s+(\S+)/
    manager.record_breakpoint(command.strip)
  end

  MCP::Tool::Response.new([{ type: "text", text: output }])
rescue DebugMcp::Error => e
  MCP::Tool::Response.new([{ type: "text", text: "Error: #{e.message}" }])
end