Merge pull request #90 from koic/doc_fix_incorrect_example_for_configuring_protocol_version

[Doc] Fix incorrect example for configuring protocol version
This commit is contained in:
Koichi ITO 2025-08-03 16:23:12 +09:00 • committed by GitHub
commit 31929784d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -326,16 +326,17 @@ config.instrumentation_callback = ->(data) {
### Server Protocol Version
The server's protocol version can be overridden using the `protocol_version` class method:
The server's protocol version can be overridden using the `protocol_version` keyword argument:
```ruby
MCP::Server.protocol_version = "2024-11-05"
configuration = MCP::Configuration.new(protocol_version: "2024-11-05")
MCP::Server.new(name: "test_server", configuration: configuration)
```
This will make all new server instances use the specified protocol version instead of the default version. The protocol version can be reset to the default by setting it to `nil`:
```ruby
MCP::Server.protocol_version = nil
MCP::Configuration.new(protocol_version: nil)
```
If an invalid `protocol_version` value is set, an `ArgumentError` is raised.