Class: RailsAiBridge::Tools::ListContextProviders::ContextProviderFormatter Private

Inherits:
Object
  • Object
show all
Includes:
Registry::Truncatable
Defined in:
lib/rails_ai_bridge/tools/list_context_providers.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 context providers section of a registry manifest as markdown.

Single responsibility: converts manifest 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(manifest) ⇒ ContextProviderFormatter

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 ContextProviderFormatter.

Parameters:



96
97
98
# File 'lib/rails_ai_bridge/tools/list_context_providers.rb', line 96

def initialize(manifest)
  @manifest = manifest
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



101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/rails_ai_bridge/tools/list_context_providers.rb', line 101

def format
  providers = @manifest.context_providers
  return 'No context providers are declared in the registry manifest.' if providers.empty?

  lines = ["# Context Providers (#{providers.length})", '']
  lines << '| Provider | Type | Endpoint | Optional | Tools |'
  lines << '|----------|------|----------|----------|-------|'
  providers.each do |name, provider|
    lines << format_row(name, provider)
  end
  lines.join("\n")
end