Class: Clacky::Mcp::Transport

Inherits:
Object
  • Object
show all
Defined in:
lib/clacky/mcp/transport.rb

Overview

Abstract transport. Concrete transports must implement:

#start            -> open the channel (spawn process / open connection)
#stop             -> close everything; must be idempotent
#alive?           -> whether the channel is healthy
#send_message(h)  -> serialize and write one JSON-RPC message
#on_message(&b)   -> register callback invoked with each parsed inbound JSON message
#stderr_tail(bytes:) -> recent diagnostic text (may be empty)

Direct Known Subclasses

HttpTransport, StdioTransport

Defined Under Namespace

Classes: TransportError

Instance Method Summary collapse

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


17
# File 'lib/clacky/mcp/transport.rb', line 17

def alive?;            raise NotImplementedError; end

#on_message(&_blk) ⇒ Object

Raises:

  • (NotImplementedError)


19
# File 'lib/clacky/mcp/transport.rb', line 19

def on_message(&_blk); raise NotImplementedError; end

#send_message(_) ⇒ Object

Raises:

  • (NotImplementedError)


18
# File 'lib/clacky/mcp/transport.rb', line 18

def send_message(_);   raise NotImplementedError; end

#startObject

Raises:

  • (NotImplementedError)


15
# File 'lib/clacky/mcp/transport.rb', line 15

def start;             raise NotImplementedError; end

#stderr_tail(bytes: 4096) ⇒ Object



20
# File 'lib/clacky/mcp/transport.rb', line 20

def stderr_tail(bytes: 4096); ""; end

#stopObject

Raises:

  • (NotImplementedError)


16
# File 'lib/clacky/mcp/transport.rb', line 16

def stop;              raise NotImplementedError; end