Class: ZeroMcp::Registry::ToolRegistry
- Inherits:
-
Struct
- Object
- Struct
- ZeroMcp::Registry::ToolRegistry
- Defined in:
- lib/zeromcp/registry.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#credential_cache ⇒ Object
Returns the value of attribute credential_cache.
-
#mcp ⇒ Object
Returns the value of attribute mcp.
-
#openapi ⇒ Object
Returns the value of attribute openapi.
-
#routes ⇒ Object
Returns the value of attribute routes.
Instance Method Summary collapse
-
#context_for(tool) ⇒ Object
Build a ready-to-use Context for
tool, using the same config-driven credential/permission rules Server#call_tool already applies — so a caller invoking a routed tool directly (route.tool.call(args, ctx)) doesn't have to hand-roll credential lookup.
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config
11 12 13 |
# File 'lib/zeromcp/registry.rb', line 11 def config @config end |
#credential_cache ⇒ Object
Returns the value of attribute credential_cache
11 12 13 |
# File 'lib/zeromcp/registry.rb', line 11 def credential_cache @credential_cache end |
#mcp ⇒ Object
Returns the value of attribute mcp
11 12 13 |
# File 'lib/zeromcp/registry.rb', line 11 def mcp @mcp end |
#openapi ⇒ Object
Returns the value of attribute openapi
11 12 13 |
# File 'lib/zeromcp/registry.rb', line 11 def openapi @openapi end |
#routes ⇒ Object
Returns the value of attribute routes
11 12 13 |
# File 'lib/zeromcp/registry.rb', line 11 def routes @routes end |
Instance Method Details
#context_for(tool) ⇒ Object
Build a ready-to-use Context for tool, using the same config-driven
credential/permission rules Server#call_tool already applies — so a
caller invoking a routed tool directly (route.tool.call(args, ctx))
doesn't have to hand-roll credential lookup.
16 17 18 19 20 21 22 23 |
# File 'lib/zeromcp/registry.rb', line 16 def context_for(tool) ZeroMcp::Context.new( tool_name: tool.name, permissions: tool., bypass: config., credentials: ZeroMcp::Credentials.resolve(tool.name, config, cache: credential_cache) ) end |