Class: ZeroMcp::ResourceScanner

Inherits:
Object
  • Object
show all
Defined in:
lib/zeromcp/scanner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ResourceScanner

Returns a new instance of ResourceScanner.



149
150
151
152
153
# File 'lib/zeromcp/scanner.rb', line 149

def initialize(config)
  @config = config
  @resources = {}
  @templates = {}
end

Instance Attribute Details

#resourcesObject (readonly)

Returns the value of attribute resources.



147
148
149
# File 'lib/zeromcp/scanner.rb', line 147

def resources
  @resources
end

#templatesObject (readonly)

Returns the value of attribute templates.



147
148
149
# File 'lib/zeromcp/scanner.rb', line 147

def templates
  @templates
end

Instance Method Details

#scanObject



155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/zeromcp/scanner.rb', line 155

def scan
  @resources.clear
  @templates.clear

  @config.resources_dir.each do |d|
    dir = File.expand_path(d)
    unless Dir.exist?(dir)
      $stderr.puts "[zeromcp] Cannot read resources directory: #{dir}"
      next
    end
    scan_dir(dir, dir)
  end
end