67 instantiations of ToolApprovalResponseContent
Microsoft.Extensions.AI.Abstractions (2)
Contents\ToolApprovalRequestContent.cs (1)
74
new
ToolApprovalResponseContent
(RequestId, approved, ToolCall) { Reason = reason };
Generated\361d1da7f942c932\JsonContext.ToolApprovalResponseContent.g.cs (1)
34
ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
((string)args[0], (bool)args[1], (global::Microsoft.Extensions.AI.ToolCallContent)args[2]),
Microsoft.Extensions.AI.Abstractions.Tests (13)
Contents\AIContentTests.cs (2)
78
new
ToolApprovalResponseContent
("request123", approved: true, new FunctionCallContent("call123", "functionName", new Dictionary<string, object?> { { "param1", 123 } })),
82
new
ToolApprovalResponseContent
("request123", approved: true, new McpServerToolCallContent("call456", "myTool2", "myServer2")),
Contents\InputResponseContentTests.cs (2)
39
new
ToolApprovalResponseContent
("request123", true, new FunctionCallContent("call123", "functionName")),
40
new
ToolApprovalResponseContent
("request456", true, new McpServerToolCallContent("call456", "myTool", "myServer")),
Contents\ToolApprovalResponseContentTests.cs (8)
16
Assert.Throws<ArgumentNullException>("requestId", () => new
ToolApprovalResponseContent
(null!, true, new FunctionCallContent("FCC1", "TestFunction")));
17
Assert.Throws<ArgumentException>("requestId", () => new
ToolApprovalResponseContent
("", true, new FunctionCallContent("FCC1", "TestFunction")));
18
Assert.Throws<ArgumentException>("requestId", () => new
ToolApprovalResponseContent
("\r\t\n ", true, new FunctionCallContent("FCC1", "TestFunction")));
19
Assert.Throws<ArgumentNullException>("toolCall", () => new
ToolApprovalResponseContent
("id", true, null!));
34
ToolApprovalResponseContent content =
new
("req-1", true, toolCall);
40
content =
new
("req-2", false, toolCall);
51
var content = new
ToolApprovalResponseContent
("request123", true, toolCall)
82
var content = new
ToolApprovalResponseContent
("request123", true, new FunctionCallContent("call123", "functionName"))
Generated\361d1da7f942c932\TestJsonSerializerContext.ToolApprovalResponseContent.g.cs (1)
32
ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
((string)args[0], (bool)args[1], (global::Microsoft.Extensions.AI.ToolCallContent)args[2]),
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Generated\361d1da7f942c932\JsonContext.ToolApprovalResponseContent.g.cs (1)
34
ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
((string)args[0], (bool)args[1], (global::Microsoft.Extensions.AI.ToolCallContent)args[2]),
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Generated\361d1da7f942c932\JsonContext.ToolApprovalResponseContent.g.cs (1)
34
ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
((string)args[0], (bool)args[1], (global::Microsoft.Extensions.AI.ToolCallContent)args[2]),
Microsoft.Extensions.AI.OpenAI (2)
OpenAIResponsesChatClient.cs (2)
246
message.Contents.Add(new
ToolApprovalResponseContent
(
549
yield return CreateUpdate(new
ToolApprovalResponseContent
(
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIResponseClientTests.cs (2)
1756
var codeInterpreterApproval = new
ToolApprovalResponseContent
("req-ci-1", true, new CodeInterpreterToolCallContent("ci-call-1"));
1757
var imageGenApproval = new
ToolApprovalResponseContent
("req-ig-1", false, new ImageGenerationToolCallContent("ig-call-1"));
Microsoft.Extensions.AI.Stabilization.Tests (1)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.ToolApprovalResponseContent.g.cs (1)
32
ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
((string)args[0], (bool)args[1], (global::Microsoft.Extensions.AI.ToolCallContent)args[2]),
Microsoft.Extensions.AI.Tests (45)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (41)
264
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
265
new
ToolApprovalResponseContent
("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
316
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
317
new
ToolApprovalResponseContent
("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
371
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
375
new
ToolApprovalResponseContent
("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
427
new
ToolApprovalResponseContent
("ficc_callId1", false, new FunctionCallContent("callId1", "Func1")),
428
new
ToolApprovalResponseContent
("ficc_callId2", false, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
486
new
ToolApprovalResponseContent
("ficc_callId1", false, new FunctionCallContent("callId1", "Func1")),
487
new
ToolApprovalResponseContent
("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
550
new
ToolApprovalResponseContent
("ficc_callId1", false, new FunctionCallContent("callId1", "Func1"))
554
new
ToolApprovalResponseContent
("ficc_callId2", false, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
617
new
ToolApprovalResponseContent
("ficc_callId1", false, new FunctionCallContent("callId1", "Func1")) { Reason = "Custom rejection for Func1" },
618
new
ToolApprovalResponseContent
("ficc_callId2", false, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } })),
619
new
ToolApprovalResponseContent
("ficc_callId3", true, new FunctionCallContent("callId3", "Func3", arguments: new Dictionary<string, object?> { { "s", "test" } }))
707
new
ToolApprovalResponseContent
("ficc_callId1", false, new FunctionCallContent("callId1", "Func1"))
766
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
767
new
ToolApprovalResponseContent
("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
820
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
821
new
ToolApprovalResponseContent
("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
831
new
ToolApprovalResponseContent
("ficc_callId3", true, new FunctionCallContent("callId3", "Func1")),
898
new
ToolApprovalResponseContent
("ficc_callId1", false, responseFcc),
970
new
ToolApprovalResponseContent
("ficc_callId1", false, response1Fcc),
978
new
ToolApprovalResponseContent
("ficc_callId2", false, request2Fcc),
1116
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
1117
new
ToolApprovalResponseContent
("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
1162
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
1163
new
ToolApprovalResponseContent
("ficc_callId2", true, new FunctionCallContent("callId2", "Func2", arguments: new Dictionary<string, object?> { { "i", 42 } }))
1206
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
1256
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
1306
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
1361
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
1419
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1")),
1692
new
ToolApprovalResponseContent
("approval-request-id", true, new FunctionCallContent("function-call-id", "Func1"))
1787
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func")),
1788
new
ToolApprovalResponseContent
("callId2", true, new McpServerToolCallContent("callId2", "McpCall", "myServer"))
1809
new
ToolApprovalResponseContent
("callId2", true, new McpServerToolCallContent("callId2", "McpCall", "myServer"))
1871
new
ToolApprovalResponseContent
("ficc_callId1", approveFuncCall, new FunctionCallContent("callId1", "Func")),
1872
new
ToolApprovalResponseContent
("callId2", approveMcpCall, new McpServerToolCallContent("callId2", "McpCall", "myServer"))
1894
new
ToolApprovalResponseContent
("callId2", approveMcpCall, new McpServerToolCallContent("callId2", "McpCall", "myServer"))
2108
new
ToolApprovalResponseContent
(tarc.RequestId, tarc.Approved, (ToolCallContent)CloneFcc(tarc.ToolCall))
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
3402
new
ToolApprovalResponseContent
("ficc_callId1", true, new FunctionCallContent("callId1", "Func1"))
3439
new
ToolApprovalResponseContent
("ficc_callId1", false, new FunctionCallContent("callId1", "Func1")) { Reason = "User denied" }
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
849
new
ToolApprovalResponseContent
("approval-1", true, toolCall),
Generated\361d1da7f942c932\TestJsonSerializerContext.ToolApprovalResponseContent.g.cs (1)
32
ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
((string)args[0], (bool)args[1], (global::Microsoft.Extensions.AI.ToolCallContent)args[2]),
187 references to ToolApprovalResponseContent
Microsoft.Extensions.AI (15)
ChatCompletion\FunctionInvokingChatClient.cs (14)
46
/// responsible for responding to that approval request by sending a corresponding <see cref="
ToolApprovalResponseContent
"/> in a subsequent
862
/// Gets whether <paramref name="messages"/> contains any <see cref="ToolApprovalRequestContent"/> or <see cref="
ToolApprovalResponseContent
"/>
871
or
ToolApprovalResponseContent
{ ToolCall: FunctionCallContent { InformationalOnly: false } });
875
/// (a <see cref="ToolApprovalRequestContent"/> or <see cref="
ToolApprovalResponseContent
"/> whose tool call is a
885
or
ToolApprovalResponseContent
{ ToolCall: FunctionCallContent { InformationalOnly: false } });
1329
/// 1. Remove all <see cref="ToolApprovalRequestContent"/> and <see cref="
ToolApprovalResponseContent
"/> from the <paramref name="originalMessages"/>.
1330
/// 2. Recreate <see cref="FunctionCallContent"/> for any <see cref="
ToolApprovalResponseContent
"/> that haven't been executed yet.
1331
/// 3. Generate failed <see cref="FunctionResultContent"/> for any rejected <see cref="
ToolApprovalResponseContent
"/>.
1429
List<
ToolApprovalResponseContent
>? allApprovalResponses = null;
1458
case
ToolApprovalResponseContent
tarc when tarc.ToolCall is FunctionCallContent { InformationalOnly: false }:
1516
foreach (
var
approvalResponse in allApprovalResponses)
1572
/// Extracts the <see cref="FunctionCallContent"/> from the provided <see cref="
ToolApprovalResponseContent
"/> to recreate the original function call messages.
1807
/// Execute the provided <see cref="
ToolApprovalResponseContent
"/> and return the resulting <see cref="FunctionCallContent"/>
1916
public
ToolApprovalResponseContent
Response { get; init; }
Common\OtelMessageSerializer.cs (1)
213
case
ToolApprovalResponseContent
farespc when farespc.ToolCall is McpServerToolCallContent:
Microsoft.Extensions.AI.Abstractions (28)
Contents\AIContent.cs (1)
26
[JsonDerivedType(typeof(
ToolApprovalResponseContent
), typeDiscriminator: "toolApprovalResponse")]
Contents\InputResponseContent.cs (1)
13
[JsonDerivedType(typeof(
ToolApprovalResponseContent
), "toolApprovalResponse")]
Contents\ToolApprovalRequestContent.cs (4)
46
/// <see cref="
ToolApprovalResponseContent
"/> still has to be supplied so the originating
68
/// Creates a <see cref="
ToolApprovalResponseContent
"/> indicating whether the tool call is approved or rejected.
72
/// <returns>The <see cref="
ToolApprovalResponseContent
"/> correlated with this request.</returns>
73
public
ToolApprovalResponseContent
CreateResponse(bool approved, string? reason = null) =>
Contents\ToolApprovalResponseContent.cs (1)
16
/// Initializes a new instance of the <see cref="
ToolApprovalResponseContent
"/> class.
Generated\361d1da7f942c932\JsonContext.ToolApprovalResponseContent.g.cs (20)
15
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>? _ToolApprovalResponseContent;
21
public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> ToolApprovalResponseContent
24
get => _ToolApprovalResponseContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
));
27
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> Create_ToolApprovalResponseContent(global::System.Text.Json.JsonSerializerOptions options)
29
if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> jsonTypeInfo))
31
var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>
37
ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(bool), typeof(global::Microsoft.Extensions.AI.ToolCallContent)}, modifiers: null),
41
jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, objectInfo);
58
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
60
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Approved,
68
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Approved", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
78
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
80
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).ToolCall,
88
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("ToolCall", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ToolCallContent), global::System.Array.Empty<global::System.Type>(), null),
99
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
101
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason,
102
Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason = value!,
109
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Reason", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
348
if (type == typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
))
Microsoft.Extensions.AI.Abstractions.Tests (39)
AssertExtensions.cs (3)
58
else if (expectedItem is
ToolApprovalResponseContent
expectedApprovalResponse)
60
var
actualApprovalResponse = (
ToolApprovalResponseContent
)chatItem;
Contents\InputResponseContentTests.cs (2)
87
var
approvalResponse = Assert.IsType<
ToolApprovalResponseContent
>(result);
Contents\ToolApprovalRequestContentTests.cs (2)
48
var
response = content.CreateResponse(approved: true);
69
var
response = content.CreateResponse(approved, reason);
Contents\ToolApprovalResponseContentTests.cs (11)
34
ToolApprovalResponseContent
content = new("req-1", true, toolCall);
51
var
content = new ToolApprovalResponseContent("request123", true, toolCall)
56
AssertSerializationRoundtrips<
ToolApprovalResponseContent
>(content);
60
static void AssertSerializationRoundtrips<T>(
ToolApprovalResponseContent
content)
67
var
deserializedContent = Assert.IsType<
ToolApprovalResponseContent
>(deserialized);
82
var
content = new ToolApprovalResponseContent("request123", true, new FunctionCallContent("call123", "functionName"))
88
var
deserializedContent = JsonSerializer.Deserialize<
ToolApprovalResponseContent
>(json, AIJsonUtilities.DefaultOptions);
123
var
approvalResponse = Assert.IsType<
ToolApprovalResponseContent
>(result);
Generated\361d1da7f942c932\TestJsonSerializerContext.GetJsonTypeInfo.g.cs (1)
350
if (type == typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
))
Generated\361d1da7f942c932\TestJsonSerializerContext.ToolApprovalResponseContent.g.cs (20)
13
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>? _ToolApprovalResponseContent;
19
public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> ToolApprovalResponseContent
22
get => _ToolApprovalResponseContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
));
25
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> Create_ToolApprovalResponseContent(global::System.Text.Json.JsonSerializerOptions options)
27
if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> jsonTypeInfo))
29
var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>
35
ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(bool), typeof(global::Microsoft.Extensions.AI.ToolCallContent)}, modifiers: null),
39
jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, objectInfo);
56
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
58
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Approved,
66
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Approved", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
76
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
78
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).ToolCall,
86
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("ToolCall", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ToolCallContent), global::System.Array.Empty<global::System.Type>(), null),
97
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
99
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason,
100
Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason = value!,
107
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Reason", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Microsoft.Extensions.AI.Evaluation.Reporting (21)
Generated\361d1da7f942c932\JsonContext.ToolApprovalResponseContent.g.cs (20)
15
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>? _ToolApprovalResponseContent;
21
public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> ToolApprovalResponseContent
24
get => _ToolApprovalResponseContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
));
27
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> Create_ToolApprovalResponseContent(global::System.Text.Json.JsonSerializerOptions options)
29
if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> jsonTypeInfo))
31
var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>
37
ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(bool), typeof(global::Microsoft.Extensions.AI.ToolCallContent)}, modifiers: null),
41
jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, objectInfo);
58
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
60
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Approved,
68
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Approved", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
78
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
80
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).ToolCall,
88
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("ToolCall", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ToolCallContent), global::System.Array.Empty<global::System.Type>(), null),
99
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
101
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason,
102
Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason = value!,
109
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Reason", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
220
if (type == typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
))
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (21)
Generated\361d1da7f942c932\JsonContext.ToolApprovalResponseContent.g.cs (20)
15
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>? _ToolApprovalResponseContent;
21
public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> ToolApprovalResponseContent
24
get => _ToolApprovalResponseContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
));
27
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> Create_ToolApprovalResponseContent(global::System.Text.Json.JsonSerializerOptions options)
29
if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> jsonTypeInfo))
31
var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>
37
ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(bool), typeof(global::Microsoft.Extensions.AI.ToolCallContent)}, modifiers: null),
41
jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, objectInfo);
58
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
60
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Approved,
68
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Approved", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
78
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
80
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).ToolCall,
88
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("ToolCall", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ToolCallContent), global::System.Array.Empty<global::System.Type>(), null),
99
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
101
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason,
102
Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason = value!,
109
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Reason", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.GetJsonTypeInfo.g.cs (1)
216
if (type == typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
))
Microsoft.Extensions.AI.OpenAI (3)
OpenAIRealtimeClientSession.cs (1)
657
if (firstContent is
ToolApprovalResponseContent
approvalResponse)
OpenAIResponsesChatClient.cs (2)
1320
ToolApprovalResponseContent
{ ToolCall: McpServerToolCallContent } toolResp => ResponseItem.CreateMcpApprovalResponseItem(toolResp.RequestId, toolResp.Approved),
1410
case
ToolApprovalResponseContent
toolResp when toolResp.ToolCall is McpServerToolCallContent:
Microsoft.Extensions.AI.OpenAI.Tests (13)
OpenAIConversionTests.cs (8)
1050
ToolApprovalResponseContent
? approvalResponse = updates[3].Contents.OfType<
ToolApprovalResponseContent
>().FirstOrDefault();
1142
Assert.Empty(updates[0].Contents.OfType<
ToolApprovalResponseContent
>());
1147
Assert.IsNotType<
ToolApprovalResponseContent
>(genericContent);
1363
ToolApprovalResponseContent
? approvalResponseContent = message.Contents.OfType<
ToolApprovalResponseContent
>().FirstOrDefault();
1434
Assert.Empty(message.Contents.OfType<
ToolApprovalResponseContent
>());
1439
Assert.IsNotType<
ToolApprovalResponseContent
>(genericContent);
OpenAIResponseClientTests.cs (2)
1756
var
codeInterpreterApproval = new ToolApprovalResponseContent("req-ci-1", true, new CodeInterpreterToolCallContent("ci-call-1"));
1757
var
imageGenApproval = new ToolApprovalResponseContent("req-ig-1", false, new ImageGenerationToolCallContent("ig-call-1"));
parent\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (3)
58
else if (expectedItem is
ToolApprovalResponseContent
expectedApprovalResponse)
60
var
actualApprovalResponse = (
ToolApprovalResponseContent
)chatItem;
Microsoft.Extensions.AI.Stabilization.Tests (21)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.GetJsonTypeInfo.g.cs (1)
122
if (type == typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
))
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.ToolApprovalResponseContent.g.cs (20)
13
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>? _ToolApprovalResponseContent;
19
public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> ToolApprovalResponseContent
22
get => _ToolApprovalResponseContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
));
25
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> Create_ToolApprovalResponseContent(global::System.Text.Json.JsonSerializerOptions options)
27
if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> jsonTypeInfo))
29
var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>
35
ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(bool), typeof(global::Microsoft.Extensions.AI.ToolCallContent)}, modifiers: null),
39
jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, objectInfo);
56
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
58
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Approved,
66
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Approved", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
76
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
78
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).ToolCall,
86
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("ToolCall", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ToolCallContent), global::System.Array.Empty<global::System.Type>(), null),
97
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
99
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason,
100
Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason = value!,
107
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Reason", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
Microsoft.Extensions.AI.Tests (26)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (2)
2107
ToolApprovalResponseContent
tarc =>
2144
.OfType<
ToolApprovalResponseContent
>()
Generated\361d1da7f942c932\TestJsonSerializerContext.GetJsonTypeInfo.g.cs (1)
230
if (type == typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
))
Generated\361d1da7f942c932\TestJsonSerializerContext.ToolApprovalResponseContent.g.cs (20)
13
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>? _ToolApprovalResponseContent;
19
public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> ToolApprovalResponseContent
22
get => _ToolApprovalResponseContent ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
));
25
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> Create_ToolApprovalResponseContent(global::System.Text.Json.JsonSerializerOptions options)
27
if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
> jsonTypeInfo))
29
var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>
35
ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(bool), typeof(global::Microsoft.Extensions.AI.ToolCallContent)}, modifiers: null),
39
jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
>(options, objectInfo);
56
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
58
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Approved,
66
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Approved", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
76
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
78
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).ToolCall,
86
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("ToolCall", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.ToolCallContent), global::System.Array.Empty<global::System.Type>(), null),
97
DeclaringType = typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
),
99
Getter = static obj => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason,
100
Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
)obj).Reason = value!,
107
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.
ToolApprovalResponseContent
).GetProperty("Reason", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
parent\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (3)
58
else if (expectedItem is
ToolApprovalResponseContent
expectedApprovalResponse)
60
var
actualApprovalResponse = (
ToolApprovalResponseContent
)chatItem;