Class: Sidekiq::Mcp::ToolsRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/mcp/tools.rb

Instance Method Summary collapse

Constructor Details

#initializeToolsRegistry

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

#listObject



13
14
15
# File 'lib/sidekiq/mcp/tools.rb', line 13

def list
  @tools.values
end