Class: RailsAiBridge::Tools::ListContextProviders
- Defined in:
- lib/rails_ai_bridge/tools/list_context_providers.rb
Overview
MCP tool for listing context providers declared in the registry manifest.
Context providers are external services (currently MCP servers) that the
bridge can query for project context. This tool reads the
context_providers section of the registry manifest and returns a
formatted list with each provider's type, endpoint, optional flag, and
requested tool specs.
Defined Under Namespace
Classes: ContextProviderFormatter
Constant Summary collapse
- ENDPOINT_MAX_LENGTH =
80- SETUP_DOC_PATH =
'docs/skill-registry-guide.md'- SETUP_MESSAGE =
<<~MSG.freeze No registry manifest found at `%<path>s`. To use context providers, create a registry manifest file. See `#{SETUP_DOC_PATH}` for a step-by-step guide. Quick start — add `config/rails_ai_bridge/registry.json` to your Rails app: ```json { "version": "1.0.0", "packs": {}, "default_stack": [], "context_providers": {} } ``` Then configure the registry in `config/initializers/rails_ai_bridge.rb`: ```ruby RailsAiBridge.configure do |config| config.registry.registry_manifest_path = "config/rails_ai_bridge/registry.json" end ``` Once configured, add context providers and run `rails ai:skills:list` to verify. MSG
Class Method Summary collapse
-
.call(_server_context: nil) ⇒ MCP::Tool::Response
Formatted provider list or a setup/error message.
Methods inherited from BaseTool
cached_context, cached_section, config, rails_app, reset_cache!, text_response
Class Method Details
.call(_server_context: nil) ⇒ MCP::Tool::Response
Returns formatted provider list or a setup/error message.
61 62 63 64 65 66 |
# File 'lib/rails_ai_bridge/tools/list_context_providers.rb', line 61 def self.call(_server_context: nil) manifest = load_manifest return text_response(format(SETUP_MESSAGE, path: manifest_path)) unless manifest text_response(ContextProviderFormatter.new(manifest).format) end |