Class: RubyLLM::MCP::Adapters::MCPTransports::CoordinatorStub
- Inherits:
-
Object
- Object
- RubyLLM::MCP::Adapters::MCPTransports::CoordinatorStub
- Defined in:
- lib/ruby_llm/mcp/adapters/mcp_transports/coordinator_stub.rb
Overview
Minimal coordinator stub for MCP transports The native transports expect a coordinator object, but for the MCP SDK adapter we don't need to process results (just pass them through) as MCP SDK adapter doesn't methods that requires responsing to the MCP server as of yet.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#protocol_version ⇒ Object
readonly
Returns the value of attribute protocol_version.
-
#transport ⇒ Object
Returns the value of attribute transport.
Instance Method Summary collapse
- #client_capabilities ⇒ Object
-
#initialize(protocol_version:, notification_callback: nil) ⇒ CoordinatorStub
constructor
A new instance of CoordinatorStub.
- #process_result(result) ⇒ Object
- #request(body, **options) ⇒ Object
Constructor Details
#initialize(protocol_version:, notification_callback: nil) ⇒ CoordinatorStub
Returns a new instance of CoordinatorStub.
12 13 14 15 16 17 |
# File 'lib/ruby_llm/mcp/adapters/mcp_transports/coordinator_stub.rb', line 12 def initialize(protocol_version:, notification_callback: nil) @name = "MCP-SDK-Adapter" @protocol_version = protocol_version @transport = nil @notification_callback = notification_callback end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/ruby_llm/mcp/adapters/mcp_transports/coordinator_stub.rb', line 9 def name @name end |
#protocol_version ⇒ Object (readonly)
Returns the value of attribute protocol_version.
9 10 11 |
# File 'lib/ruby_llm/mcp/adapters/mcp_transports/coordinator_stub.rb', line 9 def protocol_version @protocol_version end |
#transport ⇒ Object
Returns the value of attribute transport.
10 11 12 |
# File 'lib/ruby_llm/mcp/adapters/mcp_transports/coordinator_stub.rb', line 10 def transport @transport end |
Instance Method Details
#client_capabilities ⇒ Object
30 31 32 |
# File 'lib/ruby_llm/mcp/adapters/mcp_transports/coordinator_stub.rb', line 30 def client_capabilities {} # MCP SDK doesn't provide client capabilities end |
#process_result(result) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ruby_llm/mcp/adapters/mcp_transports/coordinator_stub.rb', line 19 def process_result(result) if result&.notification? @notification_callback&.call(result.notification) return nil end return nil if result&.request? result end |
#request(body, **options) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/ruby_llm/mcp/adapters/mcp_transports/coordinator_stub.rb', line 34 def request(body, **) # For notifications (cancelled, etc), we need to send them through the transport return nil unless @transport @transport.request(body, **) end |