Class: Hitch::MCP::Registry
- Inherits:
-
Object
- Object
- Hitch::MCP::Registry
- Defined in:
- app/models/hitch/mcp/registry.rb
Overview
Explicit host allowlist for MCP tools. Subclasses declare named Tool classes; Internal::RegistryRuntime validates the declarations into a persistent snapshot and resolves tools per request.
Direct Known Subclasses
Class Method Summary collapse
- .declarations ⇒ Object
- .inherited(subclass) ⇒ Object
- .register(tool_class = nil, scopes: nil) ⇒ Object
Class Method Details
.declarations ⇒ Object
27 28 29 |
# File 'app/models/hitch/mcp/registry.rb', line 27 def declarations @hitch_mcp_declarations ||= [].freeze end |
.inherited(subclass) ⇒ Object
12 13 14 15 |
# File 'app/models/hitch/mcp/registry.rb', line 12 def inherited(subclass) super subclass.instance_variable_set(:@hitch_mcp_declarations, [].freeze) end |
.register(tool_class = nil, scopes: nil) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/models/hitch/mcp/registry.rb', line 17 def register(tool_class = nil, scopes: nil) declaration = Declaration.new( class_name: declaration_class_name(tool_class), scopes: declaration_scopes(scopes), source: declaration_source(tool_class) ) @hitch_mcp_declarations = (declarations + [ declaration ]).freeze tool_class end |