Class: McpToolkit::Authority::SingleToolProvider
- Inherits:
-
Object
- Object
- McpToolkit::Authority::SingleToolProvider
- Defined in:
- lib/mcp_toolkit/authority/single_tool_provider.rb
Overview
A tool_provider serving exactly one bespoke authority tool alongside the
generic Registry-backed ones — the shape every host with a single custom tool
would otherwise hand-roll. Used automatically by the composed default
provider for bare tool classes in config.extra_tool_providers.
The tool must expose .definition (the tools/list entry) and .tool_name,
and itself satisfy the dispatcher's tool contract (required_permissions_scope
call) — e.g. a class built on McpToolkit::Tools::AuthorityBase. It is advertised unconditionally; its scope/authorization gates are enforced at call time (by the dispatcher and the tool itself).
Instance Method Summary collapse
- #find(name) ⇒ Object
-
#initialize(tool) ⇒ SingleToolProvider
constructor
A new instance of SingleToolProvider.
- #tool_definitions(_context) ⇒ Object
Constructor Details
#initialize(tool) ⇒ SingleToolProvider
Returns a new instance of SingleToolProvider.
14 15 16 |
# File 'lib/mcp_toolkit/authority/single_tool_provider.rb', line 14 def initialize(tool) @tool = tool end |
Instance Method Details
#find(name) ⇒ Object
22 23 24 |
# File 'lib/mcp_toolkit/authority/single_tool_provider.rb', line 22 def find(name) name.to_s == @tool.tool_name ? @tool : nil end |
#tool_definitions(_context) ⇒ Object
18 19 20 |
# File 'lib/mcp_toolkit/authority/single_tool_provider.rb', line 18 def tool_definitions(_context) [@tool.definition] end |