36 instantiations of McpServerToolCallContent
Microsoft.Extensions.AI.Abstractions.Tests (15)
Contents\AIContentTests.cs (3)
79new McpServerToolCallContent("call123", "myTool", "myServer"), 81new ToolApprovalRequestContent("request123", new McpServerToolCallContent("call123", "myTool", "myServer")), 82new ToolApprovalResponseContent("request123", approved: true, new McpServerToolCallContent("call456", "myTool2", "myServer2")),
Contents\InputRequestContentTests.cs (1)
41new ToolApprovalRequestContent("request456", new McpServerToolCallContent("call456", "myTool", "myServer")),
Contents\InputResponseContentTests.cs (1)
40new ToolApprovalResponseContent("request456", true, new McpServerToolCallContent("call456", "myTool", "myServer")),
Contents\McpServerToolCallContentTests.cs (7)
16McpServerToolCallContent c = new("callId1", "toolName", null); 30McpServerToolCallContent c = new("callId1", "toolName", "serverName"); 55Assert.Throws<ArgumentException>("callId", () => new McpServerToolCallContent(string.Empty, "name", null)); 56Assert.Throws<ArgumentException>("name", () => new McpServerToolCallContent("callId1", string.Empty, null)); 58Assert.Throws<ArgumentNullException>("callId", () => new McpServerToolCallContent(null!, "name", null)); 59Assert.Throws<ArgumentNullException>("name", () => new McpServerToolCallContent("callId1", null!, null)); 65var content = new McpServerToolCallContent("call123", "myTool", "myServer")
Contents\ToolApprovalRequestContentTests.cs (1)
25new McpServerToolCallContent("MCC1", "TestTool", "TestServer") { Arguments = new Dictionary<string, object?> { { "arg1", "value1" } } },
Contents\ToolApprovalResponseContentTests.cs (1)
25new McpServerToolCallContent("MCC1", "TestTool", "TestServer") { Arguments = new Dictionary<string, object?> { { "arg1", "value1" } } },
Contents\ToolCallContentTests.cs (1)
57new McpServerToolCallContent("call2", "myTool", "myServer"),
Microsoft.Extensions.AI.OpenAI (6)
OpenAIRealtimeClientSession.cs (3)
1186new McpServerToolCallContent(callId, mcpItem.ToolName ?? string.Empty, mcpItem.ServerLabel) 1223var toolCall = new McpServerToolCallContent(approvalId, approvalItem.ToolName ?? string.Empty, approvalItem.ServerLabel) 1241contents.Add(new McpServerToolCallContent(toolDef.Name, toolDef.Name, toolListItem.ServerLabel)
OpenAIResponsesChatClient.cs (3)
226var approvalRequest = new ToolApprovalRequestContent(mtcari.Id, new McpServerToolCallContent(mtcari.Id, mtcari.ToolName, mtcari.ServerLabel) 529var streamApprovalRequest = new ToolApprovalRequestContent(mtcari.Id, new McpServerToolCallContent(mtcari.Id, mtcari.ToolName, mtcari.ServerLabel) 1845contents.Add(new McpServerToolCallContent(mtci.Id, mtci.ToolName, mtci.ServerLabel)
Microsoft.Extensions.AI.OpenAI.Tests (1)
OpenAIConversionTests.cs (1)
1489var mcpToolCall = new McpServerToolCallContent("call_123", "get_weather", "weather_server") { Arguments = new Dictionary<string, object?> { ["city"] = "Seattle" } };
Microsoft.Extensions.AI.Tests (14)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (11)
1744new ToolApprovalRequestContent("callId2", new McpServerToolCallContent("callId2", "McpCall", "myServer")) 1753new ToolApprovalRequestContent("callId2", new McpServerToolCallContent("callId2", "McpCall", "myServer")) 1783new ToolApprovalRequestContent("callId2", new McpServerToolCallContent("callId2", "McpCall", "myServer")) 1788new ToolApprovalResponseContent("callId2", true, new McpServerToolCallContent("callId2", "McpCall", "myServer")) 1797new ToolApprovalRequestContent("callId2", new McpServerToolCallContent("callId2", "McpCall", "myServer")) 1809new ToolApprovalResponseContent("callId2", true, new McpServerToolCallContent("callId2", "McpCall", "myServer")) 1867new ToolApprovalRequestContent("callId2", new McpServerToolCallContent("callId2", "McpCall", "myServer")) 1872new ToolApprovalResponseContent("callId2", approveMcpCall, new McpServerToolCallContent("callId2", "McpCall", "myServer")) 1880new ToolApprovalRequestContent("callId2", new McpServerToolCallContent("callId2", "McpCall", "myServer")) 1894new ToolApprovalResponseContent("callId2", approveMcpCall, new McpServerToolCallContent("callId2", "McpCall", "myServer")) 2094McpServerToolCallContent mstcc => new McpServerToolCallContent(mstcc.CallId, mstcc.Name, mstcc.ServerName)
ChatCompletion\OpenTelemetryChatClientTests.cs (3)
665new McpServerToolCallContent("mcp-call-1", "myTool", "myServer") { Arguments = new Dictionary<string, object?> { ["param1"] = "value1" } }, 690yield return new() { Contents = [new McpServerToolCallContent("mcp-call-1", "myTool", "myServer") { Arguments = new Dictionary<string, object?> { ["param1"] = "value1" } }] }; 836var toolCall = new McpServerToolCallContent("mcp-call-2", "dangerousTool", "secureServer")
62 references to McpServerToolCallContent
Microsoft.Extensions.AI (4)
Common\OtelMessageSerializer.cs (3)
176case McpServerToolCallContent mstcc: 200case ToolApprovalRequestContent fareqc when fareqc.ToolCall is McpServerToolCallContent mcpToolCall: 213case ToolApprovalResponseContent farespc when farespc.ToolCall is McpServerToolCallContent:
Realtime\OpenTelemetryRealtimeClientSession.cs (1)
596case McpServerToolCallContent mstcc:
Microsoft.Extensions.AI.Abstractions (3)
Contents\AIContent.cs (1)
27[JsonDerivedType(typeof(McpServerToolCallContent), typeDiscriminator: "mcpServerToolCall")]
Contents\McpServerToolCallContent.cs (1)
23/// Initializes a new instance of the <see cref="McpServerToolCallContent"/> class.
Contents\ToolCallContent.cs (1)
14[JsonDerivedType(typeof(McpServerToolCallContent), "mcpServerToolCall")]
Microsoft.Extensions.AI.Abstractions.Tests (11)
AssertExtensions.cs (2)
80McpServerToolCallContent mcp => (mcp.Name, mcp.Arguments), 87McpServerToolCallContent mcp => (mcp.Name, mcp.Arguments),
Contents\McpServerToolCallContentTests.cs (9)
16McpServerToolCallContent c = new("callId1", "toolName", null); 30McpServerToolCallContent c = new("callId1", "toolName", "serverName"); 65var content = new McpServerToolCallContent("call123", "myTool", "myServer") 70AssertSerializationRoundtrips<McpServerToolCallContent>(content); 74static void AssertSerializationRoundtrips<T>(McpServerToolCallContent content) 81var deserializedContent = Assert.IsType<McpServerToolCallContent>(deserialized); 111var mcpCall = Assert.IsType<McpServerToolCallContent>(result);
Microsoft.Extensions.AI.OpenAI (7)
OpenAIRealtimeClientSession.cs (1)
1223var toolCall = new McpServerToolCallContent(approvalId, approvalItem.ToolName ?? string.Empty, approvalItem.ServerLabel)
OpenAIResponsesChatClient.cs (6)
1290Dictionary<string, McpServerToolCallContent>? idToContentMapping = null; 1323ToolApprovalResponseContent { ToolCall: McpServerToolCallContent } toolResp => ResponseItem.CreateMcpApprovalResponseItem(toolResp.RequestId, toolResp.Approved), 1413case ToolApprovalResponseContent toolResp when toolResp.ToolCall is McpServerToolCallContent: 1577case McpServerToolCallContent mstcc: 1590case ToolApprovalRequestContent toolReq when toolReq.ToolCall is McpServerToolCallContent mcpToolCall: 1601if (idToContentMapping?.TryGetValue(mstrc.CallId, out McpServerToolCallContent? associatedCall) is true)
Microsoft.Extensions.AI.OpenAI.Tests (33)
OpenAIConversionTests.cs (13)
1025McpServerToolCallContent? mcpToolCallContent = updates[1].Contents.OfType<McpServerToolCallContent>().FirstOrDefault(); 1045McpServerToolCallContent nestedMcpCall = Assert.IsType<McpServerToolCallContent>(approvalRequest.ToolCall); 1058McpServerToolCallContent correlatedMcpCall = Assert.IsType<McpServerToolCallContent>(approvalResponse.ToolCall); 1335McpServerToolCallContent? mcpToolCall = message.Contents.OfType<McpServerToolCallContent>().FirstOrDefault(c => c.CallId == "mcp_call_123"); 1356McpServerToolCallContent nestedMcpCall = Assert.IsType<McpServerToolCallContent>(approvalRequestContent.ToolCall); 1371McpServerToolCallContent correlatedMcpCall = Assert.IsType<McpServerToolCallContent>(approvalResponseContent.ToolCall); 1489var mcpToolCall = new McpServerToolCallContent("call_123", "get_weather", "weather_server") { Arguments = new Dictionary<string, object?> { ["city"] = "Seattle" } };
OpenAIResponseClientIntegrationTests.cs (6)
233Assert.NotEmpty(response.Messages.SelectMany(m => m.Contents).OfType<McpServerToolCallContent>()); 337Assert.NotEmpty(response.Messages.SelectMany(m => m.Contents).OfType<McpServerToolCallContent>()); 541var mcpCallContent = Assert.IsType<McpServerToolCallContent>(approvalRequest.ToolCall); 551var toolCall = Assert.Single(response.Messages.SelectMany(m => m.Contents).OfType<McpServerToolCallContent>());
OpenAIResponseClientTests.cs (12)
1739var call = Assert.IsType<McpServerToolCallContent>(message.Contents[0]); 2116var firstCall = Assert.IsType<McpServerToolCallContent>(message.Contents[1]); 2128var secondCall = Assert.IsType<McpServerToolCallContent>(message.Contents[3]); 2527var firstCall = Assert.IsType<McpServerToolCallContent>(message.Contents[1]); 2539var secondCall = Assert.IsType<McpServerToolCallContent>(message.Contents[3]); 2736var toolCall = Assert.IsType<McpServerToolCallContent>(message.Contents[1]);
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (2)
80McpServerToolCallContent mcp => (mcp.Name, mcp.Arguments), 87McpServerToolCallContent mcp => (mcp.Name, mcp.Arguments),
Microsoft.Extensions.AI.Tests (4)
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (1)
2094McpServerToolCallContent mstcc => new McpServerToolCallContent(mstcc.CallId, mstcc.Name, mstcc.ServerName)
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
836var toolCall = new McpServerToolCallContent("mcp-call-2", "dangerousTool", "secureServer")
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (2)
80McpServerToolCallContent mcp => (mcp.Name, mcp.Arguments), 87McpServerToolCallContent mcp => (mcp.Name, mcp.Arguments),