Class: DocOpsLab::MCP::Manifest
- Inherits:
-
Object
- Object
- DocOpsLab::MCP::Manifest
- Defined in:
- lib/docopslab/mcp/manifest.rb
Overview
Loads MCP resource and tool definitions from a YAML manifest.
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ Manifest
constructor
A new instance of Manifest.
- #normalize_resource(entry) ⇒ Object
- #normalize_tool(entry) ⇒ Object
- #resources ⇒ Object
- #tools ⇒ Object
Constructor Details
#initialize(data) ⇒ Manifest
Returns a new instance of Manifest.
9 10 11 |
# File 'lib/docopslab/mcp/manifest.rb', line 9 def initialize data @data = data end |
Class Method Details
.load(path) ⇒ Object
13 14 15 16 17 |
# File 'lib/docopslab/mcp/manifest.rb', line 13 def self.load path raise ArgumentError, 'Manifest path is required' if path.nil? || path == '' new(YAML.safe_load_file(path, symbolize_names: true, aliases: true)) end |
Instance Method Details
#normalize_resource(entry) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/docopslab/mcp/manifest.rb', line 27 def normalize_resource entry { uri: entry[:href], name: entry[:name], description: entry[:desc], mime_type: entry[:mime], source_path: entry[:path], packaged_name: entry[:file] } end |
#normalize_tool(entry) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/docopslab/mcp/manifest.rb', line 38 def normalize_tool entry { name: entry[:name], # Convert dots to spaces, capitalize initials title: entry[:title] || entry[:name].tr('.', ' ').split.map(&:capitalize).join(' '), description: entry[:desc], input_schema: normalize_schema(entry[:input_schema]), annotations: entry[:annotations] } end |
#resources ⇒ Object
19 20 21 |
# File 'lib/docopslab/mcp/manifest.rb', line 19 def resources Array(@data[:resources]) end |
#tools ⇒ Object
23 24 25 |
# File 'lib/docopslab/mcp/manifest.rb', line 23 def tools Array(@data[:tools]) end |