From 29b369326e5306dacf7bbe62a770101c82c2dc82 Mon Sep 17 00:00:00 2001 From: Shutkov Maksim Date: Tue, 24 Feb 2026 16:10:46 +0300 Subject: [PATCH 1/2] update base ruby logic and settings for supporting ruby 2.6 --- .github/workflows/ci.yml | 1 + .rubocop.yml | 2 +- lib/mcp/prompt.rb | 2 +- lib/mcp/server.rb | 5 ++++- mcp.gemspec | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9077935..fb28d88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ jobs: strategy: matrix: entry: + - { ruby: '2.6', allowed-failure: false } - { ruby: '2.7', allowed-failure: false } - { ruby: '3.0', allowed-failure: false } - { ruby: '3.1', allowed-failure: false } diff --git a/.rubocop.yml b/.rubocop.yml index 2120de4..d2b3632 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,7 +6,7 @@ plugins: - rubocop-rake AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 2.6 Gemspec/DevelopmentDependencies: Enabled: true diff --git a/lib/mcp/prompt.rb b/lib/mcp/prompt.rb index 128ee47..03b81c3 100644 --- a/lib/mcp/prompt.rb +++ b/lib/mcp/prompt.rb @@ -114,7 +114,7 @@ def validate_arguments!(args) private def required_args - arguments_value.filter_map { |arg| arg.name.to_sym if arg.required } + arguments_value.map { |arg| arg.name.to_sym if arg.required }.compact end end end diff --git a/lib/mcp/server.rb b/lib/mcp/server.rb index 80cacd6..ee5049f 100644 --- a/lib/mcp/server.rb +++ b/lib/mcp/server.rb @@ -254,7 +254,10 @@ def validate! end def validate_tool_name! - duplicated_tool_names = @tool_names.tally.filter_map { |name, count| name if count >= 2 } + duplicated_tool_names = @tool_names + .each_with_object(Hash.new(0)) { |name, counts| counts[name] += 1 } + .select { |_name, count| count >= 2 } + .keys raise ToolNotUnique, duplicated_tool_names unless duplicated_tool_names.empty? end diff --git a/mcp.gemspec b/mcp.gemspec index b1f7667..c0141e4 100644 --- a/mcp.gemspec +++ b/mcp.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |spec| spec.license = "Apache-2.0" # Since this library is used by a broad range of users, it does not align its support policy with Ruby's EOL. - spec.required_ruby_version = ">= 2.7.0" + spec.required_ruby_version = ">= 2.6.0" spec.metadata["allowed_push_host"] = "https://rubygems.org" spec.metadata["changelog_uri"] = "https://github.com/modelcontextprotocol/ruby-sdk/releases/tag/v#{spec.version}" From 3e98ccd2c1f61a953b841f340351f60e6c2fee52 Mon Sep 17 00:00:00 2001 From: Shutkov Maksim Date: Tue, 24 Feb 2026 16:28:06 +0300 Subject: [PATCH 2/2] improved --- mcp.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcp.gemspec b/mcp.gemspec index c0141e4..55dad0a 100644 --- a/mcp.gemspec +++ b/mcp.gemspec @@ -31,5 +31,5 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency("json-schema", ">= 4.1") + spec.add_dependency("json-schema", ">= 4.1", "< 6.0") end