Table of Contents

Class ToolResponse

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

The output from a server-side ToolCall execution. This message contains the results of a tool invocation that was initiated by a ToolCall from the model. The client should pass this ToolResponse back to the API in a subsequent turn within a Content message, along with the corresponding ToolCall.

public record ToolResponse : IEquatable<ToolResponse>
Inheritance
ToolResponse
Implements
Inherited Members

Properties

Id

The identifier of the tool call this response is for.

[JsonPropertyName("id")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Id { get; set; }

Property Value

string

Response

The tool response.

[JsonPropertyName("response")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, object>? Response { get; set; }

Property Value

Dictionary<string, object>

ToolType

The type of tool that was called, matching the tool_type in the corresponding ToolCall.

[JsonPropertyName("toolType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ToolType? ToolType { get; set; }

Property Value

ToolType?

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a ToolResponse object.

public static ToolResponse? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

ToolResponse

The deserialized ToolResponse object, or null if deserialization fails.