Class: Mcp::Tools::Manager
- Inherits:
-
Object
- Object
- Mcp::Tools::Manager
- Includes:
- VersionHelper
- Defined in:
- app/services/mcp/tools/manager.rb
Defined Under Namespace
Classes: InvalidVersionFormatError, ToolNotFoundError, VersionNotFoundError
Constant Summary collapse
- CUSTOM_TOOLS =
Registry of all custom tools mapped to their service classes
{ 'get_mcp_server_version' => ::Mcp::Tools::GetServerVersionService }.freeze
- GRAPHQL_TOOLS =
{ 'create_workitem_note' => ::Mcp::Tools::WorkItems::GraphqlCreateWorkItemNoteService, 'get_workitem_notes' => ::Mcp::Tools::WorkItems::GraphqlGetWorkItemNotesService, 'search_labels' => ::Mcp::Tools::Labels::GraphqlSearchService }.freeze
Instance Attribute Summary collapse
-
#alias_map ⇒ Object
readonly
Returns the value of attribute alias_map.
-
#tools ⇒ Object
readonly
Returns the value of attribute tools.
Instance Method Summary collapse
- #get_tool(name:, version: nil) ⇒ Object
-
#initialize ⇒ Manager
constructor
A new instance of Manager.
- #list_tools ⇒ Object
Methods included from VersionHelper
Constructor Details
#initialize ⇒ Manager
Returns a new instance of Manager.
51 52 53 54 |
# File 'app/services/mcp/tools/manager.rb', line 51 def initialize @tools = build_tools @alias_map = build_alias_map end |
Instance Attribute Details
#alias_map ⇒ Object (readonly)
Returns the value of attribute alias_map.
49 50 51 |
# File 'app/services/mcp/tools/manager.rb', line 49 def alias_map @alias_map end |
#tools ⇒ Object (readonly)
Returns the value of attribute tools.
49 50 51 |
# File 'app/services/mcp/tools/manager.rb', line 49 def tools @tools end |
Instance Method Details
#get_tool(name:, version: nil) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/services/mcp/tools/manager.rb', line 60 def get_tool(name:, version: nil) raise InvalidVersionFormatError, version if version && !validate_semantic_version(version) canonical_name = resolve_alias(name) return get_custom_tool(canonical_name, version) if CUSTOM_TOOLS.key?(canonical_name) return get_graphql_tool(canonical_name, version) if GRAPHQL_TOOLS.key?(canonical_name) return get_api_tool(canonical_name, version) if discover_api_tools.key?(canonical_name) return get_aggregated_api_tool(canonical_name, version) if discover_aggregated_api_tools.key?(canonical_name) raise ToolNotFoundError, name end |
#list_tools ⇒ Object
56 57 58 |
# File 'app/services/mcp/tools/manager.rb', line 56 def list_tools tools end |