class RubyLLM::ServerToolCall
A ServerToolCall records one provider-executed tool step in an assistant response: a web search the model ran, a code execution, or the results block a provider returned for one. They appear on Message#server_tool_calls when a chat enables tools with Chat#with_server_tools.
response = chat.with_server_tools(:web_search).ask "What changed in Ruby 3.5?" response.server_tool_calls.map(&:type) # => ["server_tool_use", "web_search_tool_result"]
RubyLLM does not model each tool’s result schema. raw always holds the provider’s block exactly as received, and is what RubyLLM replays to the provider in subsequent turns when the wire format requires it.
Attributes
The provider’s identifier for the call, or nil.
The input the model gave the tool (a query, code to run), in the provider’s shape, or nil.
The tool name when the provider reports one, such as "web_search", or nil.
The complete provider block as received, used verbatim when the conversation is sent back to the provider.
The tool’s output in the provider’s shape, or nil for blocks that only record the invocation.
The provider’s block or item type, such as "server_tool_use", "web_search_tool_result", or "web_search_call".
Public Instance Methods
Source
# File lib/ruby_llm/server_tool_call.rb, line 58 def to_h { type: type, name: name, id: id, input: input, result: result, raw: raw }.compact end
Returns the call’s attributes as a Hash, omitting nil values.