Class: Sidekiq::Mcp::ToolsRegistry
- Inherits:
-
Object
- Object
- Sidekiq::Mcp::ToolsRegistry
- Defined in:
- lib/sidekiq/mcp/tools.rb
Instance Method Summary collapse
- #call(tool_name, arguments) ⇒ Object
-
#initialize ⇒ ToolsRegistry
constructor
A new instance of ToolsRegistry.
- #list ⇒ Object
Constructor Details
#initialize ⇒ ToolsRegistry
Returns a new instance of ToolsRegistry.
9 10 11 |
# File 'lib/sidekiq/mcp/tools.rb', line 9 def initialize register_all_tools end |
Instance Method Details
#call(tool_name, arguments) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sidekiq/mcp/tools.rb', line 17 def call(tool_name, arguments) tool_class = @tool_classes[tool_name] return "Unknown tool: #{tool_name}" unless tool_class begin tool_instance = tool_class.new tool_instance.call(**arguments.transform_keys(&:to_sym)) rescue => e "Error executing tool #{tool_name}: #{e.message}" end end |
#list ⇒ Object
13 14 15 |
# File 'lib/sidekiq/mcp/tools.rb', line 13 def list @tools.values end |