Table of Contents

Class ToolCall

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

A predicted server-side ToolCall returned from the model. This message contains information about a tool that the model wants to invoke. The client is NOT expected to execute this ToolCall. Instead, the client should pass this ToolCall back to the API in a subsequent turn within a Content message, along with the corresponding ToolResponse.

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

Properties

Args

The tool call arguments. Example: {"arg1": "value1", "arg2": "value2"}.

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

Property Value

Dictionary<string, object>

Id

Unique identifier of the tool call. The server returns the tool response with the matching id.

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

Property Value

string

ToolType

The type of tool that was called.

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

Property Value

ToolType?

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a ToolCall object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

ToolCall

The deserialized ToolCall object, or null if deserialization fails.