Class: LLM::MCP::Mailbox

Inherits:
Object
  • Object
show all
Defined in:
lib/llm/mcp/mailbox.rb

Overview

A per-request mailbox for routing a JSON-RPC response back to the caller waiting on that request id.

Instance Method Summary collapse

Constructor Details

#initializeMailbox

Returns a new instance of Mailbox.



8
9
10
# File 'lib/llm/mcp/mailbox.rb', line 8

def initialize
  @queue = Queue.new
end

Instance Method Details

#<<(message) ⇒ Object



12
13
14
15
# File 'lib/llm/mcp/mailbox.rb', line 12

def <<(message)
  @queue << message
  self
end

#popObject



17
18
19
20
21
# File 'lib/llm/mcp/mailbox.rb', line 17

def pop
  @queue.pop(true)
rescue ThreadError
  nil
end