Class: RailsAiBridge::Tools::ResolveSkill
- Extended by:
- Registry::Truncatable
- Defined in:
- lib/rails_ai_bridge/tools/resolve_skill.rb
Overview
MCP tool that resolves and returns the full content of a named skill or agent.
Looks up the skill or agent in the loaded skill pack registry, following priority ordering and deprecation redirects, and returns its complete markdown content so AI assistants can read and apply the guidance directly without falling back to rake tasks or file reads.
Constant Summary collapse
- NOT_FOUND_MESSAGE =
"Skill `%<name>s` not found in the loaded skill packs.\n\n" \ 'Use `rails_list_registry type=skills` to see available skills.'
- NOT_FOUND_AGENT_MESSAGE =
"Agent `%<name>s` not found in the loaded skill packs.\n\n" \ 'Use `rails_list_registry type=agents` to see available agents.'
- NO_REGISTRY_MESSAGE =
"No registry manifest found at `%<path>s`.\n\n" \ 'Use `rails_list_registry type=skills` for setup instructions.'
- PACK_MISMATCH_MESSAGE =
"Skill `%<name>s` was found in pack `%<actual>s`, not `%<requested>s`.\n\n" \ 'Returning the skill from `%<actual>s`. Use `pack=` only to disambiguate ' \ 'when the same skill name exists in multiple packs.'
Class Method Summary collapse
-
.call(name:, pack: nil, type: 'skill', _server_context: nil) ⇒ MCP::Tool::Response
Full skill/agent content or an error message.
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:, pack: nil, type: 'skill', _server_context: nil) ⇒ MCP::Tool::Response
Returns full skill/agent content or an error message.
65 66 67 68 69 70 71 72 73 |
# File 'lib/rails_ai_bridge/tools/resolve_skill.rb', line 65 def self.call(name:, pack: nil, type: 'skill', _server_context: nil) resolver = Registry.build_resolver return text_response(format(NO_REGISTRY_MESSAGE, path: manifest_path)) unless resolver resolved = resolve(resolver, name: name, pack: pack, type: type) return text_response((name, type)) unless resolved text_response(format_response(resolved, requested_pack: pack)) end |