Class: RosettAi::Mcp::Resources::ConfigResource
- Inherits:
-
Object
- Object
- RosettAi::Mcp::Resources::ConfigResource
- Defined in:
- lib/rosett_ai/mcp/resources/config_resource.rb
Overview
MCP resource provider for compiled configuration.
Exposes compiled configuration scopes as MCP resources.
Constant Summary collapse
- URI_PREFIX =
'rosett-ai://config/'- SCOPES =
['managed', 'user', 'project', 'local'].freeze
Instance Method Summary collapse
-
#list ⇒ Array<Hash>
Lists available config resources.
-
#read(scope) ⇒ Hash?
Reads a specific config scope.
Instance Method Details
#list ⇒ Array<Hash>
Lists available config resources.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rosett_ai/mcp/resources/config_resource.rb', line 22 def list SCOPES.filter_map do |scope| path = scope_path(scope) next unless path&.exist? { uri: "#{URI_PREFIX}#{scope}", name: "config-#{scope}", description: "Compiled configuration: #{scope} scope", mime_type: 'application/json' } end end |
#read(scope) ⇒ Hash?
Reads a specific config scope.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rosett_ai/mcp/resources/config_resource.rb', line 40 def read(scope) return nil unless SCOPES.include?(scope) path = scope_path(scope) return nil unless path&.exist? { uri: "#{URI_PREFIX}#{scope}", content: File.read(path), mime_type: 'application/json' } end |