Class: MCP::Configuration
- Inherits:
-
Object
- Object
- MCP::Configuration
- Defined in:
- lib/mcp/configuration.rb
Constant Summary collapse
- DEFAULT_PROTOCOL_VERSION =
"2025-06-18"- SUPPORTED_PROTOCOL_VERSIONS =
[DEFAULT_PROTOCOL_VERSION, "2025-03-26", "2024-11-05"]
Instance Attribute Summary collapse
- #exception_reporter ⇒ Object
- #instrumentation_callback ⇒ Object
-
#validate_tool_call_arguments ⇒ Object
Returns the value of attribute validate_tool_call_arguments.
Instance Method Summary collapse
- #exception_reporter? ⇒ Boolean
-
#initialize(exception_reporter: nil, instrumentation_callback: nil, protocol_version: nil, validate_tool_call_arguments: true) ⇒ Configuration
constructor
A new instance of Configuration.
- #instrumentation_callback? ⇒ Boolean
- #merge(other) ⇒ Object
- #protocol_version ⇒ Object
- #protocol_version=(protocol_version) ⇒ Object
- #protocol_version? ⇒ Boolean
- #validate_tool_call_arguments? ⇒ Boolean
Constructor Details
#initialize(exception_reporter: nil, instrumentation_callback: nil, protocol_version: nil, validate_tool_call_arguments: true) ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mcp/configuration.rb', line 10 def initialize(exception_reporter: nil, instrumentation_callback: nil, protocol_version: nil, validate_tool_call_arguments: true) @exception_reporter = exception_reporter @instrumentation_callback = instrumentation_callback @protocol_version = protocol_version if protocol_version validate_protocol_version!(protocol_version) end validate_value_of_validate_tool_call_arguments!(validate_tool_call_arguments) @validate_tool_call_arguments = validate_tool_call_arguments end |
Instance Attribute Details
#exception_reporter ⇒ Object
43 44 45 |
# File 'lib/mcp/configuration.rb', line 43 def exception_reporter @exception_reporter || default_exception_reporter end |
#instrumentation_callback ⇒ Object
51 52 53 |
# File 'lib/mcp/configuration.rb', line 51 def instrumentation_callback @instrumentation_callback || default_instrumentation_callback end |
#validate_tool_call_arguments ⇒ Object
Returns the value of attribute validate_tool_call_arguments.
59 60 61 |
# File 'lib/mcp/configuration.rb', line 59 def validate_tool_call_arguments @validate_tool_call_arguments end |
Instance Method Details
#exception_reporter? ⇒ Boolean
47 48 49 |
# File 'lib/mcp/configuration.rb', line 47 def exception_reporter? !@exception_reporter.nil? end |
#instrumentation_callback? ⇒ Boolean
55 56 57 |
# File 'lib/mcp/configuration.rb', line 55 def instrumentation_callback? !@instrumentation_callback.nil? end |
#merge(other) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/mcp/configuration.rb', line 65 def merge(other) return self if other.nil? exception_reporter = if other.exception_reporter? other.exception_reporter else @exception_reporter end instrumentation_callback = if other.instrumentation_callback? other.instrumentation_callback else @instrumentation_callback end protocol_version = if other.protocol_version? other.protocol_version else @protocol_version end validate_tool_call_arguments = other.validate_tool_call_arguments Configuration.new( exception_reporter:, instrumentation_callback:, protocol_version:, validate_tool_call_arguments:, ) end |
#protocol_version ⇒ Object
35 36 37 |
# File 'lib/mcp/configuration.rb', line 35 def protocol_version @protocol_version || DEFAULT_PROTOCOL_VERSION end |
#protocol_version=(protocol_version) ⇒ Object
23 24 25 26 27 |
# File 'lib/mcp/configuration.rb', line 23 def protocol_version=(protocol_version) validate_protocol_version!(protocol_version) @protocol_version = protocol_version end |
#protocol_version? ⇒ Boolean
39 40 41 |
# File 'lib/mcp/configuration.rb', line 39 def protocol_version? !@protocol_version.nil? end |
#validate_tool_call_arguments? ⇒ Boolean
61 62 63 |
# File 'lib/mcp/configuration.rb', line 61 def validate_tool_call_arguments? !!@validate_tool_call_arguments end |