Module: Omnibot::Tool::SafeExecute

Defined in:
lib/omnibot/tool.rb

Overview

NOTE: this wrapper shadows execute's signature (method(:execute).parameters becomes [[:keyrest, :kwargs]]), so ruby_llm signature inference cannot be relied on — class-form tools must declare param explicitly.

Instance Method Summary collapse

Instance Method Details

#execute(**kwargs) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/omnibot/tool.rb', line 35

def execute(**kwargs)
  ActiveSupport::Notifications.instrument(
    "omnibot.tool.call", tool: self.class, name: name, args: kwargs
  ) do |payload|
    super
  rescue StandardError => e
    payload[:error] = e.message
    raise Omnibot::ToolError, e.message if Omnibot.config.on_tool_error == :raise
    { error: e.message }
  end
end