Class: SwarmSDK::CustomToolRegistry::NamedToolWrapper

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/swarm_sdk/custom_tool_registry.rb

Overview

Wrapper that overrides the tool's name to match the registered name

This ensures that when a user registers a tool with a specific name, that name is what gets used for tool lookup (has_tool?) and LLM tool calls.

Instance Method Summary collapse

Constructor Details

#initialize(tool, registered_name) ⇒ NamedToolWrapper

Returns a new instance of NamedToolWrapper.



65
66
67
68
# File 'lib/swarm_sdk/custom_tool_registry.rb', line 65

def initialize(tool, registered_name)
  super(tool)
  @registered_name = registered_name.to_s
end

Instance Method Details

#nameObject

Override name to return the registered name



71
72
73
# File 'lib/swarm_sdk/custom_tool_registry.rb', line 71

def name
  @registered_name
end