Internal Release 0.5.1
- Allow protocol version to be set at the server level through configuration instead of a class method, providing more flexibility in protocol version management [#43](https://github.com/Shopify/mcp-ruby/pull/43) @topherbullock - Fixed instrumentation handling to ensure accurate timing information and proper error reporting [#42](https://github.com/Shopify/mcp-ruby/pull/42) @tobiasbales - Improved error handling and reporting in the server - Fixed timing information collection in instrumentation - Added proper error types for different failure scenarios - Enhanced test coverage for error cases - [Allow protocol version to be set at the server level #43](https://github.com/Shopify/mcp-ruby/pull/43) @topherbullock - [Fix instrumentation handling #42](https://github.com/Shopify/mcp-ruby/pull/42) @tobiasbales
This commit is contained in:
parent
7175d49108
commit
d2b6a33788
1 changed files with 248 additions and 86 deletions
|
|
@ -2,11 +2,22 @@
|
|||
|
||||
module ModelContextProtocol
|
||||
class Configuration
|
||||
attr_writer :exception_reporter, :instrumentation_callback
|
||||
DEFAULT_PROTOCOL_VERSION = "2025-03-26"
|
||||
|
||||
def initialize(exception_reporter: nil, instrumentation_callback: nil)
|
||||
attr_writer :exception_reporter, :instrumentation_callback, :protocol_version
|
||||
|
||||
def initialize(exception_reporter: nil, instrumentation_callback: nil, protocol_version: nil)
|
||||
@exception_reporter = exception_reporter
|
||||
@instrumentation_callback = instrumentation_callback
|
||||
@protocol_version = protocol_version
|
||||
end
|
||||
|
||||
def protocol_version
|
||||
@protocol_version || DEFAULT_PROTOCOL_VERSION
|
||||
end
|
||||
|
||||
def protocol_version?
|
||||
!@protocol_version.nil?
|
||||
end
|
||||
|
||||
def exception_reporter
|
||||
|
|
@ -38,10 +49,16 @@ module ModelContextProtocol
|
|||
else
|
||||
@instrumentation_callback
|
||||
end
|
||||
protocol_version = if other.protocol_version?
|
||||
other.protocol_version
|
||||
else
|
||||
@protocol_version
|
||||
end
|
||||
|
||||
Configuration.new(
|
||||
exception_reporter:,
|
||||
instrumentation_callback:,
|
||||
protocol_version:,
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue