Class ToolResponse
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
Response
The tool response.
[JsonPropertyName("response")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, object>? Response { get; set; }
Property Value
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
Methods
FromJson(string, JsonSerializerOptions?)
Deserializes a JSON string to a ToolResponse object.
public static ToolResponse? FromJson(string jsonString, JsonSerializerOptions? options = null)
Parameters
jsonStringstringThe JSON string to deserialize.
optionsJsonSerializerOptionsOptional JsonSerializerOptions.
Returns
- ToolResponse
The deserialized ToolResponse object, or null if deserialization fails.