ruby_llm_swarm-mcp 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -44
  3. data/lib/generators/ruby_llm/mcp/install/templates/initializer.rb +4 -21
  4. data/lib/generators/ruby_llm/mcp/install/templates/mcps.yml +0 -20
  5. data/lib/ruby_llm/mcp/auth/browser/http_server.rb +3 -0
  6. data/lib/ruby_llm/mcp/auth/browser/opener.rb +2 -0
  7. data/lib/ruby_llm/mcp/auth/browser/pages.rb +32 -100
  8. data/lib/ruby_llm/mcp/auth/browser_oauth_provider.rb +6 -32
  9. data/lib/ruby_llm/mcp/auth/http_response_handler.rb +2 -0
  10. data/lib/ruby_llm/mcp/auth/memory_storage.rb +0 -18
  11. data/lib/ruby_llm/mcp/auth/oauth_provider.rb +3 -82
  12. data/lib/ruby_llm/mcp/auth/session_manager.rb +2 -0
  13. data/lib/ruby_llm/mcp/auth/url_builder.rb +2 -0
  14. data/lib/ruby_llm/mcp/client.rb +32 -119
  15. data/lib/ruby_llm/mcp/configuration.rb +6 -74
  16. data/lib/ruby_llm/mcp/coordinator.rb +304 -0
  17. data/lib/ruby_llm/mcp/elicitation.rb +6 -8
  18. data/lib/ruby_llm/mcp/errors.rb +0 -15
  19. data/lib/ruby_llm/mcp/notification_handler.rb +5 -21
  20. data/lib/ruby_llm/mcp/notifications/cancelled.rb +32 -0
  21. data/lib/ruby_llm/mcp/notifications/initialize.rb +24 -0
  22. data/lib/ruby_llm/mcp/notifications/roots_list_change.rb +26 -0
  23. data/lib/ruby_llm/mcp/prompt.rb +7 -7
  24. data/lib/ruby_llm/mcp/protocol.rb +34 -0
  25. data/lib/ruby_llm/mcp/railtie.rb +6 -8
  26. data/lib/ruby_llm/mcp/requests/completion_prompt.rb +50 -0
  27. data/lib/ruby_llm/mcp/requests/completion_resource.rb +50 -0
  28. data/lib/ruby_llm/mcp/requests/initialization.rb +34 -0
  29. data/lib/ruby_llm/mcp/requests/logging_set_level.rb +28 -0
  30. data/lib/ruby_llm/mcp/requests/ping.rb +24 -0
  31. data/lib/ruby_llm/mcp/requests/prompt_call.rb +32 -0
  32. data/lib/ruby_llm/mcp/requests/prompt_list.rb +31 -0
  33. data/lib/ruby_llm/mcp/requests/resource_list.rb +31 -0
  34. data/lib/ruby_llm/mcp/requests/resource_read.rb +30 -0
  35. data/lib/ruby_llm/mcp/requests/resource_template_list.rb +31 -0
  36. data/lib/ruby_llm/mcp/requests/resources_subscribe.rb +30 -0
  37. data/lib/ruby_llm/mcp/requests/shared/meta.rb +32 -0
  38. data/lib/ruby_llm/mcp/requests/shared/pagination.rb +17 -0
  39. data/lib/ruby_llm/mcp/requests/tool_call.rb +35 -0
  40. data/lib/ruby_llm/mcp/requests/tool_list.rb +31 -0
  41. data/lib/ruby_llm/mcp/resource.rb +8 -6
  42. data/lib/ruby_llm/mcp/resource_template.rb +7 -7
  43. data/lib/ruby_llm/mcp/response_handler.rb +67 -0
  44. data/lib/ruby_llm/mcp/responses/elicitation.rb +33 -0
  45. data/lib/ruby_llm/mcp/responses/error.rb +33 -0
  46. data/lib/ruby_llm/mcp/responses/ping.rb +28 -0
  47. data/lib/ruby_llm/mcp/responses/roots_list.rb +31 -0
  48. data/lib/ruby_llm/mcp/responses/sampling_create_message.rb +50 -0
  49. data/lib/ruby_llm/mcp/result.rb +4 -8
  50. data/lib/ruby_llm/mcp/roots.rb +4 -4
  51. data/lib/ruby_llm/mcp/sample.rb +2 -6
  52. data/lib/ruby_llm/mcp/tool.rb +9 -9
  53. data/lib/ruby_llm/mcp/transport.rb +151 -0
  54. data/lib/ruby_llm/mcp/transports/sse.rb +435 -0
  55. data/lib/ruby_llm/mcp/transports/stdio.rb +231 -0
  56. data/lib/ruby_llm/mcp/transports/streamable_http.rb +725 -0
  57. data/lib/ruby_llm/mcp/transports/support/http_client.rb +28 -0
  58. data/lib/ruby_llm/mcp/transports/support/rate_limit.rb +47 -0
  59. data/lib/ruby_llm/mcp/transports/support/timeout.rb +34 -0
  60. data/lib/ruby_llm/mcp/version.rb +1 -1
  61. data/lib/ruby_llm/mcp.rb +7 -30
  62. metadata +38 -33
  63. data/lib/ruby_llm/mcp/adapters/base_adapter.rb +0 -179
  64. data/lib/ruby_llm/mcp/adapters/mcp_sdk_adapter.rb +0 -292
  65. data/lib/ruby_llm/mcp/adapters/mcp_transports/coordinator_stub.rb +0 -33
  66. data/lib/ruby_llm/mcp/adapters/mcp_transports/sse.rb +0 -52
  67. data/lib/ruby_llm/mcp/adapters/mcp_transports/stdio.rb +0 -52
  68. data/lib/ruby_llm/mcp/adapters/mcp_transports/streamable_http.rb +0 -86
  69. data/lib/ruby_llm/mcp/adapters/ruby_llm_adapter.rb +0 -92
  70. data/lib/ruby_llm/mcp/auth/transport_oauth_helper.rb +0 -107
  71. data/lib/ruby_llm/mcp/native/cancellable_operation.rb +0 -57
  72. data/lib/ruby_llm/mcp/native/client.rb +0 -387
  73. data/lib/ruby_llm/mcp/native/json_rpc.rb +0 -170
  74. data/lib/ruby_llm/mcp/native/messages/helpers.rb +0 -39
  75. data/lib/ruby_llm/mcp/native/messages/notifications.rb +0 -42
  76. data/lib/ruby_llm/mcp/native/messages/requests.rb +0 -206
  77. data/lib/ruby_llm/mcp/native/messages/responses.rb +0 -106
  78. data/lib/ruby_llm/mcp/native/messages.rb +0 -36
  79. data/lib/ruby_llm/mcp/native/notification.rb +0 -16
  80. data/lib/ruby_llm/mcp/native/protocol.rb +0 -36
  81. data/lib/ruby_llm/mcp/native/response_handler.rb +0 -110
  82. data/lib/ruby_llm/mcp/native/transport.rb +0 -88
  83. data/lib/ruby_llm/mcp/native/transports/sse.rb +0 -607
  84. data/lib/ruby_llm/mcp/native/transports/stdio.rb +0 -356
  85. data/lib/ruby_llm/mcp/native/transports/streamable_http.rb +0 -926
  86. data/lib/ruby_llm/mcp/native/transports/support/http_client.rb +0 -28
  87. data/lib/ruby_llm/mcp/native/transports/support/rate_limit.rb +0 -49
  88. data/lib/ruby_llm/mcp/native/transports/support/timeout.rb +0 -36
  89. data/lib/ruby_llm/mcp/native.rb +0 -12
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "httpx"
4
+
5
+ module RubyLLM
6
+ module MCP
7
+ module Transports
8
+ module Support
9
+ class HTTPClient
10
+ CONNECTION_KEY = :ruby_llm_mcp_client_connection
11
+
12
+ def self.connection
13
+ Thread.current[CONNECTION_KEY] ||= build_connection
14
+ end
15
+
16
+ def self.build_connection
17
+ HTTPX.with(
18
+ pool_options: {
19
+ max_connections: RubyLLM::MCP.config.max_connections,
20
+ pool_timeout: RubyLLM::MCP.config.pool_timeout
21
+ }
22
+ )
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyLLM
4
+ module MCP
5
+ module Transports
6
+ module Support
7
+ class RateLimit
8
+ def initialize(limit: 10, interval: 1000)
9
+ @limit = limit
10
+ @interval = interval
11
+ @timestamps = []
12
+ @mutex = Mutex.new
13
+ end
14
+
15
+ def exceeded?
16
+ now = current_time
17
+
18
+ @mutex.synchronize do
19
+ purge_old(now)
20
+ @timestamps.size >= @limit
21
+ end
22
+ end
23
+
24
+ def add
25
+ now = current_time
26
+
27
+ @mutex.synchronize do
28
+ purge_old(now)
29
+ @timestamps << now
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def current_time
36
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
37
+ end
38
+
39
+ def purge_old(now)
40
+ cutoff = now - @interval
41
+ @timestamps.reject! { |t| t < cutoff }
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyLLM
4
+ module MCP
5
+ module Transports
6
+ module Support
7
+ module Timeout
8
+ def with_timeout(seconds, request_id: nil)
9
+ result = nil
10
+ exception = nil
11
+
12
+ worker = Thread.new do
13
+ result = yield
14
+ rescue StandardError => e
15
+ exception = e
16
+ end
17
+
18
+ if worker.join(seconds)
19
+ raise exception if exception
20
+
21
+ result
22
+ else
23
+ worker.kill # stop the thread (can still have some risk if shared resources)
24
+ raise RubyLLM::MCP::Errors::TimeoutError.new(
25
+ message: "Request timed out after #{seconds} seconds",
26
+ request_id: request_id
27
+ )
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RubyLLM
4
4
  module MCP
5
- VERSION = "0.8.0"
5
+ VERSION = "0.8.1"
6
6
  end
7
7
  end
data/lib/ruby_llm/mcp.rb CHANGED
@@ -1,24 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Standard Libraries
4
- require "cgi"
5
- require "erb"
6
- require "json"
7
- require "logger"
8
- require "open3"
9
- require "rbconfig"
10
- require "securerandom"
11
- require "socket"
12
- require "timeout"
13
- require "uri"
14
- require "yaml"
15
-
16
- # Gems
17
- require "httpx"
18
- require "json-schema"
19
3
  require "ruby_llm"
4
+ require "json-schema"
20
5
  require "zeitwerk"
21
-
22
6
  require_relative "chat"
23
7
 
24
8
  module RubyLLM
@@ -100,26 +84,19 @@ module RubyLLM
100
84
  end
101
85
  end
102
86
 
103
- loader = Zeitwerk::Loader.for_gem_extension(RubyLLM)
104
-
105
- loader.ignore("#{__dir__}/mcp/railtie.rb")
87
+ require_relative "mcp/railtie" if defined?(Rails::Railtie)
106
88
 
89
+ loader = Zeitwerk::Loader.for_gem_extension(RubyLLM)
107
90
  loader.inflector.inflect("mcp" => "MCP")
108
91
  loader.inflector.inflect("sse" => "SSE")
109
92
  loader.inflector.inflect("openai" => "OpenAI")
110
93
  loader.inflector.inflect("streamable_http" => "StreamableHTTP")
111
94
  loader.inflector.inflect("http_client" => "HTTPClient")
112
- loader.inflector.inflect("http_server" => "HttpServer")
113
-
114
- loader.inflector.inflect("ruby_llm_adapter" => "RubyLLMAdapter")
115
- loader.inflector.inflect("mcp_sdk_adapter" => "MCPSdkAdapter")
116
- loader.inflector.inflect("mcp_transports" => "MCPTransports")
117
-
118
95
  loader.inflector.inflect("oauth_provider" => "OAuthProvider")
96
+ loader.inflector.inflect("browser_oauth" => "BrowserOAuth")
119
97
  loader.inflector.inflect("browser_oauth_provider" => "BrowserOAuthProvider")
98
+ loader.inflector.inflect("http_server" => "HttpServer")
99
+ loader.inflector.inflect("callback_handler" => "CallbackHandler")
100
+ loader.inflector.inflect("callback_server" => "CallbackServer")
120
101
 
121
102
  loader.setup
122
-
123
- if defined?(Rails::Railtie)
124
- require_relative "mcp/railtie"
125
- end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_llm_swarm-mcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Vice
@@ -53,8 +53,7 @@ dependencies:
53
53
  version: '2'
54
54
  description: |
55
55
  A Ruby client for the Model Context Protocol (MCP) that seamlessly integrates with RubyLLM.
56
- Supports both native full-featured implementation and the official mcp-sdk gem.
57
- Connect to MCP servers via SSE, stdio, or HTTP transports, automatically convert MCP tools into
56
+ Connect to MCP servers via SSE or stdio transports, automatically convert MCP tools into
58
57
  RubyLLM-compatible tools, and enable AI models to interact with external data sources and
59
58
  services. Makes using MCP with RubyLLM as easy as possible.
60
59
  email:
@@ -83,13 +82,6 @@ files:
83
82
  - lib/generators/ruby_llm/mcp/oauth/templates/views/show.html.erb
84
83
  - lib/ruby_llm/chat.rb
85
84
  - lib/ruby_llm/mcp.rb
86
- - lib/ruby_llm/mcp/adapters/base_adapter.rb
87
- - lib/ruby_llm/mcp/adapters/mcp_sdk_adapter.rb
88
- - lib/ruby_llm/mcp/adapters/mcp_transports/coordinator_stub.rb
89
- - lib/ruby_llm/mcp/adapters/mcp_transports/sse.rb
90
- - lib/ruby_llm/mcp/adapters/mcp_transports/stdio.rb
91
- - lib/ruby_llm/mcp/adapters/mcp_transports/streamable_http.rb
92
- - lib/ruby_llm/mcp/adapters/ruby_llm_adapter.rb
93
85
  - lib/ruby_llm/mcp/attachment.rb
94
86
  - lib/ruby_llm/mcp/auth.rb
95
87
  - lib/ruby_llm/mcp/auth/browser/callback_handler.rb
@@ -111,46 +103,59 @@ files:
111
103
  - lib/ruby_llm/mcp/auth/security.rb
112
104
  - lib/ruby_llm/mcp/auth/session_manager.rb
113
105
  - lib/ruby_llm/mcp/auth/token_manager.rb
114
- - lib/ruby_llm/mcp/auth/transport_oauth_helper.rb
115
106
  - lib/ruby_llm/mcp/auth/url_builder.rb
116
107
  - lib/ruby_llm/mcp/client.rb
117
108
  - lib/ruby_llm/mcp/completion.rb
118
109
  - lib/ruby_llm/mcp/configuration.rb
119
110
  - lib/ruby_llm/mcp/content.rb
111
+ - lib/ruby_llm/mcp/coordinator.rb
120
112
  - lib/ruby_llm/mcp/elicitation.rb
121
113
  - lib/ruby_llm/mcp/error.rb
122
114
  - lib/ruby_llm/mcp/errors.rb
123
115
  - lib/ruby_llm/mcp/logging.rb
124
- - lib/ruby_llm/mcp/native.rb
125
- - lib/ruby_llm/mcp/native/cancellable_operation.rb
126
- - lib/ruby_llm/mcp/native/client.rb
127
- - lib/ruby_llm/mcp/native/json_rpc.rb
128
- - lib/ruby_llm/mcp/native/messages.rb
129
- - lib/ruby_llm/mcp/native/messages/helpers.rb
130
- - lib/ruby_llm/mcp/native/messages/notifications.rb
131
- - lib/ruby_llm/mcp/native/messages/requests.rb
132
- - lib/ruby_llm/mcp/native/messages/responses.rb
133
- - lib/ruby_llm/mcp/native/notification.rb
134
- - lib/ruby_llm/mcp/native/protocol.rb
135
- - lib/ruby_llm/mcp/native/response_handler.rb
136
- - lib/ruby_llm/mcp/native/transport.rb
137
- - lib/ruby_llm/mcp/native/transports/sse.rb
138
- - lib/ruby_llm/mcp/native/transports/stdio.rb
139
- - lib/ruby_llm/mcp/native/transports/streamable_http.rb
140
- - lib/ruby_llm/mcp/native/transports/support/http_client.rb
141
- - lib/ruby_llm/mcp/native/transports/support/rate_limit.rb
142
- - lib/ruby_llm/mcp/native/transports/support/timeout.rb
143
116
  - lib/ruby_llm/mcp/notification_handler.rb
117
+ - lib/ruby_llm/mcp/notifications/cancelled.rb
118
+ - lib/ruby_llm/mcp/notifications/initialize.rb
119
+ - lib/ruby_llm/mcp/notifications/roots_list_change.rb
144
120
  - lib/ruby_llm/mcp/progress.rb
145
121
  - lib/ruby_llm/mcp/prompt.rb
122
+ - lib/ruby_llm/mcp/protocol.rb
146
123
  - lib/ruby_llm/mcp/railtie.rb
124
+ - lib/ruby_llm/mcp/requests/completion_prompt.rb
125
+ - lib/ruby_llm/mcp/requests/completion_resource.rb
126
+ - lib/ruby_llm/mcp/requests/initialization.rb
127
+ - lib/ruby_llm/mcp/requests/logging_set_level.rb
128
+ - lib/ruby_llm/mcp/requests/ping.rb
129
+ - lib/ruby_llm/mcp/requests/prompt_call.rb
130
+ - lib/ruby_llm/mcp/requests/prompt_list.rb
131
+ - lib/ruby_llm/mcp/requests/resource_list.rb
132
+ - lib/ruby_llm/mcp/requests/resource_read.rb
133
+ - lib/ruby_llm/mcp/requests/resource_template_list.rb
134
+ - lib/ruby_llm/mcp/requests/resources_subscribe.rb
135
+ - lib/ruby_llm/mcp/requests/shared/meta.rb
136
+ - lib/ruby_llm/mcp/requests/shared/pagination.rb
137
+ - lib/ruby_llm/mcp/requests/tool_call.rb
138
+ - lib/ruby_llm/mcp/requests/tool_list.rb
147
139
  - lib/ruby_llm/mcp/resource.rb
148
140
  - lib/ruby_llm/mcp/resource_template.rb
141
+ - lib/ruby_llm/mcp/response_handler.rb
142
+ - lib/ruby_llm/mcp/responses/elicitation.rb
143
+ - lib/ruby_llm/mcp/responses/error.rb
144
+ - lib/ruby_llm/mcp/responses/ping.rb
145
+ - lib/ruby_llm/mcp/responses/roots_list.rb
146
+ - lib/ruby_llm/mcp/responses/sampling_create_message.rb
149
147
  - lib/ruby_llm/mcp/result.rb
150
148
  - lib/ruby_llm/mcp/roots.rb
151
149
  - lib/ruby_llm/mcp/sample.rb
152
150
  - lib/ruby_llm/mcp/server_capabilities.rb
153
151
  - lib/ruby_llm/mcp/tool.rb
152
+ - lib/ruby_llm/mcp/transport.rb
153
+ - lib/ruby_llm/mcp/transports/sse.rb
154
+ - lib/ruby_llm/mcp/transports/stdio.rb
155
+ - lib/ruby_llm/mcp/transports/streamable_http.rb
156
+ - lib/ruby_llm/mcp/transports/support/http_client.rb
157
+ - lib/ruby_llm/mcp/transports/support/rate_limit.rb
158
+ - lib/ruby_llm/mcp/transports/support/timeout.rb
154
159
  - lib/ruby_llm/mcp/version.rb
155
160
  - lib/tasks/release.rake
156
161
  homepage: https://www.rubyllm-mcp.com
@@ -158,10 +163,10 @@ licenses:
158
163
  - MIT
159
164
  metadata:
160
165
  homepage_uri: https://www.rubyllm-mcp.com
161
- source_code_uri: https://github.com/parruda/ruby_llm-mcp
162
- changelog_uri: https://github.com/parruda/ruby_llm-mcp/commits/main
166
+ source_code_uri: https://github.com/patvice/ruby_llm-mcp
167
+ changelog_uri: https://github.com/patvice/ruby_llm-mcp/commits/main
163
168
  documentation_uri: https://www.rubyllm-mcp.com/guides/
164
- bug_tracker_uri: https://github.com/parruda/ruby_llm-mcp/issues
169
+ bug_tracker_uri: https://github.com/patvice/ruby_llm-mcp/issues
165
170
  rubygems_mfa_required: 'true'
166
171
  allowed_push_host: https://rubygems.org
167
172
  rdoc_options: []
@@ -1,179 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLLM
4
- module MCP
5
- module Adapters
6
- class BaseAdapter
7
- class << self
8
- def supported_features
9
- @supported_features ||= {}
10
- end
11
-
12
- def supports(*features)
13
- features.each { |f| supported_features[f] = true }
14
- end
15
-
16
- def support?(feature)
17
- supported_features[feature] || false
18
- end
19
-
20
- def supported_transports
21
- @supported_transports ||= []
22
- end
23
-
24
- def supports_transport(*transports)
25
- @supported_transports = transports
26
- end
27
-
28
- def transport_supported?(transport)
29
- supported_transports.include?(transport.to_sym)
30
- end
31
- end
32
-
33
- attr_reader :client
34
-
35
- def initialize(client, transport_type:, config: {})
36
- @client = client
37
- @transport_type = transport_type
38
- @config = config
39
- end
40
-
41
- def supports?(feature)
42
- self.class.support?(feature)
43
- end
44
-
45
- def validate_transport!(transport_type)
46
- unless self.class.transport_supported?(transport_type)
47
- raise Errors::UnsupportedTransport.new(
48
- message: <<~MSG.strip
49
- Transport '#{transport_type}' is not supported by #{self.class.name}.
50
- Supported transports: #{self.class.supported_transports.join(', ')}
51
- MSG
52
- )
53
- end
54
- end
55
-
56
- def start
57
- raise NotImplementedError, "#{self.class.name} must implement #start"
58
- end
59
-
60
- def stop
61
- raise NotImplementedError, "#{self.class.name} must implement #stop"
62
- end
63
-
64
- def restart!
65
- raise NotImplementedError, "#{self.class.name} must implement #restart!"
66
- end
67
-
68
- def alive?
69
- raise NotImplementedError, "#{self.class.name} must implement #alive?"
70
- end
71
-
72
- def ping
73
- raise NotImplementedError, "#{self.class.name} must implement #ping"
74
- end
75
-
76
- def capabilities
77
- raise NotImplementedError, "#{self.class.name} must implement #capabilities"
78
- end
79
-
80
- def client_capabilities
81
- raise NotImplementedError, "#{self.class.name} must implement #client_capabilities"
82
- end
83
-
84
- def tool_list(cursor: nil)
85
- raise NotImplementedError, "#{self.class.name} must implement #tool_list"
86
- end
87
-
88
- def execute_tool(name:, parameters:)
89
- raise NotImplementedError, "#{self.class.name} must implement #execute_tool"
90
- end
91
-
92
- def resource_list(cursor: nil)
93
- raise NotImplementedError, "#{self.class.name} must implement #resource_list"
94
- end
95
-
96
- def resource_read(uri:)
97
- raise NotImplementedError, "#{self.class.name} must implement #resource_read"
98
- end
99
-
100
- def prompt_list(cursor: nil)
101
- raise NotImplementedError, "#{self.class.name} must implement #prompt_list"
102
- end
103
-
104
- def execute_prompt(name:, arguments:)
105
- raise NotImplementedError, "#{self.class.name} must implement #execute_prompt"
106
- end
107
-
108
- def resource_template_list(cursor: nil) # rubocop:disable Lint/UnusedMethodArgument
109
- raise_unsupported_feature(:resource_templates)
110
- end
111
-
112
- def completion_resource(uri:, argument:, value:, context: nil) # rubocop:disable Lint/UnusedMethodArgument
113
- raise_unsupported_feature(:completions)
114
- end
115
-
116
- def completion_prompt(name:, argument:, value:, context: nil) # rubocop:disable Lint/UnusedMethodArgument
117
- raise_unsupported_feature(:completions)
118
- end
119
-
120
- def set_logging(level:) # rubocop:disable Lint/UnusedMethodArgument
121
- raise_unsupported_feature(:logging)
122
- end
123
-
124
- def resources_subscribe(uri:) # rubocop:disable Lint/UnusedMethodArgument
125
- raise_unsupported_feature(:subscriptions)
126
- end
127
-
128
- def initialize_notification
129
- raise_unsupported_feature(:notifications)
130
- end
131
-
132
- def cancelled_notification(reason:, request_id:) # rubocop:disable Lint/UnusedMethodArgument
133
- raise_unsupported_feature(:notifications)
134
- end
135
-
136
- def roots_list_change_notification
137
- raise_unsupported_feature(:notifications)
138
- end
139
-
140
- def ping_response(id:) # rubocop:disable Lint/UnusedMethodArgument
141
- raise_unsupported_feature(:responses)
142
- end
143
-
144
- def roots_list_response(id:) # rubocop:disable Lint/UnusedMethodArgument
145
- raise_unsupported_feature(:responses)
146
- end
147
-
148
- def sampling_create_message_response(id:, model:, message:, **_options) # rubocop:disable Lint/UnusedMethodArgument
149
- raise_unsupported_feature(:sampling)
150
- end
151
-
152
- def error_response(id:, message:, code: -32_000) # rubocop:disable Lint/UnusedMethodArgument
153
- raise_unsupported_feature(:responses)
154
- end
155
-
156
- def elicitation_response(id:, elicitation:) # rubocop:disable Lint/UnusedMethodArgument
157
- raise_unsupported_feature(:elicitation)
158
- end
159
-
160
- def register_resource(_resource)
161
- raise_unsupported_feature(:resource_registration)
162
- end
163
-
164
- private
165
-
166
- def raise_unsupported_feature(feature)
167
- raise Errors::UnsupportedFeature.new(
168
- message: <<~MSG.strip
169
- Feature '#{feature}' is not supported by #{self.class.name}.
170
-
171
- This feature requires the :ruby_llm adapter.
172
- Change your configuration to use adapter: :ruby_llm
173
- MSG
174
- )
175
- end
176
- end
177
- end
178
- end
179
- end