Class: RubyLLM::MCP::Extensions::Configuration
- Inherits:
-
Object
- Object
- RubyLLM::MCP::Extensions::Configuration
- Defined in:
- lib/ruby_llm/mcp/extensions/configuration.rb
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #enable_apps(config = {}) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #register(id, config = {}) ⇒ Object
- #reset! ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 |
# File 'lib/ruby_llm/mcp/extensions/configuration.rb', line 7 def initialize reset! end |
Instance Method Details
#empty? ⇒ Boolean
37 38 39 |
# File 'lib/ruby_llm/mcp/extensions/configuration.rb', line 37 def empty? to_h.empty? end |
#enable_apps(config = {}) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/ruby_llm/mcp/extensions/configuration.rb', line 25 def enable_apps(config = {}) normalized = Registry.deep_stringify_keys(config || {}) validate_apps_config!(normalized) normalized[Apps::Constants::MIME_TYPES_KEY] ||= [Apps::Constants::APP_HTML_MIME_TYPE] register(Constants::UI_EXTENSION_ID, normalized) end |
#register(id, config = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ruby_llm/mcp/extensions/configuration.rb', line 11 def register(id, config = {}) canonical_id = Registry.canonicalize_id(id) if canonical_id.nil? raise ArgumentError, "Extension id is required" end unless config.nil? || config.is_a?(Hash) raise ArgumentError, "Extension config for '#{canonical_id}' must be a Hash" end @extensions = Registry.merge(@extensions, { canonical_id => config }) self end |
#reset! ⇒ Object
41 42 43 44 |
# File 'lib/ruby_llm/mcp/extensions/configuration.rb', line 41 def reset! @extensions = {} self end |
#to_h ⇒ Object
33 34 35 |
# File 'lib/ruby_llm/mcp/extensions/configuration.rb', line 33 def to_h Registry.normalize_map(@extensions) end |