Class: RailsAiBridge::Tools::ListRegistry::RegistryCatalogFormatter Private

Inherits:
Object
  • Object
show all
Includes:
Registry::Truncatable
Defined in:
lib/rails_ai_bridge/tools/list_registry.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Formats the registry catalog as markdown for a given type.

Single responsibility: converts resolver data into display-ready markdown. Does not know about MCP, tools, or configuration.

Instance Method Summary collapse

Methods included from Registry::Truncatable

#sanitize_markdown, #truncate

Constructor Details

#initialize(resolver, type:, pack_filter: nil) ⇒ RegistryCatalogFormatter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RegistryCatalogFormatter.

Parameters:

  • resolver (Registry::Resolver)
  • type (String)

    "skills", "agents", or "packs"

  • pack_filter (String, nil) (defaults to: nil)


114
115
116
117
118
# File 'lib/rails_ai_bridge/tools/list_registry.rb', line 114

def initialize(resolver, type:, pack_filter: nil)
  @resolver    = resolver
  @type        = type
  @pack_filter = pack_filter
end

Instance Method Details

#formatString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns markdown string.

Returns:

  • (String)

    markdown string



121
122
123
124
125
126
127
# File 'lib/rails_ai_bridge/tools/list_registry.rb', line 121

def format
  case @type
  when 'skills'  then format_catalog(@resolver.list_skills,   noun: 'Skill')
  when 'agents'  then format_catalog(@resolver.list_agents,   noun: 'Agent')
  when 'packs'   then format_packs(@resolver.active_packs)
  end
end