Module: GroqRuby::MCP::Protocol

Defined in:
lib/groq_ruby/mcp/protocol.rb,
lib/groq_ruby/mcp/protocol/v2024_11_05.rb,
lib/groq_ruby/mcp/protocol/v2025_11_25.rb

Overview

Per-version MCP protocol objects. A Client delegates version-specific decisions (initialize payload shape, supported capabilities) to one of these so callers can target different MCP spec years against the same transport.

client = GroqRuby::MCP::Client.connect(
  config,
  protocol: GroqRuby::MCP::Protocol::V2024_11_05.new
)

Without an explicit ‘protocol:`, Client uses Protocol.default.

Defined Under Namespace

Classes: V2024_11_05, V2025_11_25

Class Method Summary collapse

Class Method Details

.defaultObject

Returns a fresh instance of the default protocol.

Returns:

  • (Object)

    a fresh instance of the default protocol



24
25
26
# File 'lib/groq_ruby/mcp/protocol.rb', line 24

def self.default
  V2024_11_05.new
end

.for(version) ⇒ Class?

Look up a protocol class by its wire version string. Returns ‘nil` if the version is unknown to this client.

Parameters:

  • version (String)

    e.g. ‘“2024-11-05”`

Returns:

  • (Class, nil)


19
20
21
# File 'lib/groq_ruby/mcp/protocol.rb', line 19

def self.for(version)
  registry[version]
end

.registryHash{String => Class}

Returns:

  • (Hash{String => Class})


29
30
31
32
33
34
# File 'lib/groq_ruby/mcp/protocol.rb', line 29

def self.registry
  {
    V2024_11_05::VERSION => V2024_11_05,
    V2025_11_25::VERSION => V2025_11_25
  }
end