Module: DebugMcp::PendingHttpHelper

Defined in:
lib/debug_mcp/pending_http_helper.rb

Class Method Summary collapse

Class Method Details

.pending_http_note(client) ⇒ Object

Check for pending HTTP request status and return a note string. Returns nil when there is no pending HTTP or when it is still running (normal state).



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/debug_mcp/pending_http_helper.rb', line 9

def pending_http_note(client)
  pending = client.pending_http
  return nil unless pending

  holder = pending[:holder]
  return nil unless holder[:done]

  if holder[:error]
    "Note: HTTP request (#{pending[:method]} #{pending[:url]}) failed: #{holder[:error].message}. " \
      "Use 'continue_execution' to resume."
  elsif holder[:response]
    "Note: HTTP response received (#{holder[:response][:status]}). " \
      "Use 'continue_execution' to see the full response."
  end
end