Class: RailsAiBridge::Tools::UseAgent
- Extended by:
- UsageFormatter
- Defined in:
- lib/rails_ai_bridge/tools/use_agent.rb
Overview
MCP tool that resolves an agent/workflow and returns it framed for adoption.
The agent content is wrapped in an activation directive (intent header and a follow-through footer requiring the workflow to be executed end to end) so the assistant adopts the workflow rather than merely reading it.
Constant Summary
Constants included from UsageFormatter
RailsAiBridge::Tools::UsageFormatter::NOT_FOUND_AGENT_MESSAGE, RailsAiBridge::Tools::UsageFormatter::NOT_FOUND_SKILL_MESSAGE, RailsAiBridge::Tools::UsageFormatter::NO_REGISTRY_MESSAGE, RailsAiBridge::Tools::UsageFormatter::USAGE_FOOTERS, RailsAiBridge::Tools::UsageFormatter::USAGE_VERBS
Class Method Summary collapse
-
.call(name:, _server_context: nil) ⇒ MCP::Tool::Response
Activation directive or an error message.
Methods included from UsageFormatter
Methods included from Registry::Truncatable
Methods inherited from BaseTool
cached_context, cached_section, config, rails_app, reset_cache!, text_response
Class Method Details
.call(name:, _server_context: nil) ⇒ MCP::Tool::Response
Returns activation directive or an error message.
37 38 39 40 41 42 43 44 45 |
# File 'lib/rails_ai_bridge/tools/use_agent.rb', line 37 def self.call(name:, _server_context: nil) resolver = Registry.build_resolver return text_response(format(UsageFormatter::NO_REGISTRY_MESSAGE, path: manifest_path)) unless resolver resolved = resolver.resolve_agent(name) return text_response(format(UsageFormatter::NOT_FOUND_AGENT_MESSAGE, name: name)) unless resolved text_response(format_usage(resolved, kind: :agent)) end |