class RubyLLM::ToolCall
A ToolCall is a request to run a tool with specific arguments. Instances appear in Message#tool_calls. Local calls are yielded to tool callbacks such as Chat#before_tool_call. Remote calls awaiting approval return true from remote? and appear in Chat#pending_approvals.
chat.before_tool_call do |tool_call| puts "Calling tool: #{tool_call.name}" puts "Arguments: #{tool_call.arguments}" end
Attributes
The arguments the model supplied for the invocation, as a Hash.
The unique identifier for this call. The tool result message answering this call carries the same id.
The name of the tool the model wants to invoke.
The Gemini thought signature attached to this call, or nil. RubyLLM replays it to the provider on later requests.
Public Instance Methods
Source
# File lib/ruby_llm/tool_call.rb, line 29 def remote? = @remote
Returns true if the provider executes this call after approval. Local tools executed by the application return false.
Source
# File lib/ruby_llm/tool_call.rb, line 48 def to_h { id: @id, name: @name, arguments: @arguments, remote: remote? || nil, thought_signature: @thought_signature }.compact end
Returns the call as a Hash, omitting nil values.