Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2daa4b4
Initial plan
Copilot Jan 30, 2026
b5dac2d
Rebase
jozkee Jan 30, 2026
052dbe3
Add CompatibilitySuppressions.xml
jozkee Jan 30, 2026
59b5ebb
Fix ToolName->Name and CloneFcc to handle McpServerToolCallContent
Copilot Jan 30, 2026
500863e
Remove duplicate assertion for mcpCallContent.Name
Copilot Jan 30, 2026
0ee1ed6
Update handling of experimental McpServerTool types in sourcegen seri…
jozkee Jan 30, 2026
cd19f1e
Remove User prefix from Input contents and rename id -> requestId
jozkee Feb 6, 2026
d2d6aa2
Use string.Empty on mcp approval requests
jozkee Feb 4, 2026
b81cb33
Remove AuthorizationToken and make Headers settable
jozkee Feb 6, 2026
4515843
Prefix RequestIds with ficc_ on FunctionInvokingChatClient
jozkee Feb 6, 2026
7fe9c0d
Rename serverUrl -> serverAddress to align with string overload
jozkee Feb 6, 2026
b5bb861
OpenAI: Revert to use ErrorContent and TextContent
jozkee Feb 6, 2026
ca5d7d3
Remove Experimental
jozkee Feb 6, 2026
23eed81
Update CompatibilitySuppressions.xml
jozkee Feb 6, 2026
4cc083c
Cleanup JsonPolymorphic for Stabilized types
jozkee Feb 6, 2026
f5e3b37
Update test
jozkee Feb 6, 2026
74a1165
Merge branch 'main' of https://github.com/dotnet/extensions into temp
jozkee Feb 6, 2026
9a950b3
Fix merge errors
jozkee Feb 6, 2026
66e28b1
Revert "Use string.Empty on mcp approval requests"
jozkee Feb 6, 2026
8579d3c
Fix more merge errors
jozkee Feb 6, 2026
2d8bd4f
Improve docs
jozkee Feb 6, 2026
7fd2c4a
Address jsonpolymorphic feedback and improve tests
jozkee Feb 6, 2026
2c5f6fb
McpToolCallApprovalResponseItem conversion to MEAI correctly and impl…
jozkee Feb 6, 2026
ced9e36
Fix roundtrip of McpServerToolResultContent.Result
jozkee Feb 6, 2026
89a0ba9
Refactor approval request ID generation in FunctionInvokingChatClient
jozkee Feb 6, 2026
d0a56eb
Address documentation feedback for MCP content types and Headers prop…
Copilot Feb 7, 2026
f9e7e0e
Apply documentation suggestions from @jozkee
Copilot Feb 7, 2026
a43576a
Add remarks to McpServerToolCallContent constructor documentation
Copilot Feb 9, 2026
420502e
Fix case-insensitive Bearer token extraction and add test, fix MakeAp…
Copilot Feb 9, 2026
ec9ebec
Trim both ends of header value and allow flexible whitespace after Be…
Copilot Feb 9, 2026
6127a72
Address feedback
jozkee Feb 10, 2026
80b4e96
Merge branch 'main' of https://github.com/dotnet/extensions into copi…
jozkee Feb 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/apicompat/overview -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Microsoft.Extensions.AI.McpServerToolApprovalRequestContent</Target>
<Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Microsoft.Extensions.AI.McpServerToolApprovalResponseContent</Target>
<Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolCallContent.get_ToolName</Target>
<Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolCallContent.get_Arguments</Target>
<Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolResultContent.get_Output</Target>
<Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolResultContent.set_Output(System.Collections.Generic.IList{Microsoft.Extensions.AI.AIContent})</Target>
<Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Microsoft.Extensions.AI.McpServerToolApprovalRequestContent</Target>
<Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Microsoft.Extensions.AI.McpServerToolApprovalResponseContent</Target>
<Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolCallContent.get_ToolName</Target>
<Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolCallContent.get_Arguments</Target>
<Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolResultContent.get_Output</Target>
<Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolResultContent.set_Output(System.Collections.Generic.IList{Microsoft.Extensions.AI.AIContent})</Target>
<Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Microsoft.Extensions.AI.McpServerToolApprovalRequestContent</Target>
<Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Microsoft.Extensions.AI.McpServerToolApprovalResponseContent</Target>
<Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolCallContent.get_ToolName</Target>
<Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolCallContent.get_Arguments</Target>
<Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolResultContent.get_Output</Target>
<Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolResultContent.set_Output(System.Collections.Generic.IList{Microsoft.Extensions.AI.AIContent})</Target>
<Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Microsoft.Extensions.AI.McpServerToolApprovalRequestContent</Target>
<Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Microsoft.Extensions.AI.McpServerToolApprovalResponseContent</Target>
<Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolCallContent.get_ToolName</Target>
<Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolCallContent.get_Arguments</Target>
<Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolResultContent.get_Output</Target>
<Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolResultContent.set_Output(System.Collections.Generic.IList{Microsoft.Extensions.AI.AIContent})</Target>
<Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Microsoft.Extensions.AI.McpServerToolApprovalRequestContent</Target>
<Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Microsoft.Extensions.AI.McpServerToolApprovalResponseContent</Target>
<Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolCallContent.get_ToolName</Target>
<Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolCallContent.get_Arguments</Target>
<Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolResultContent.get_Output</Target>
<Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.McpServerToolResultContent.set_Output(System.Collections.Generic.IList{Microsoft.Extensions.AI.AIContent})</Target>
<Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ namespace Microsoft.Extensions.AI;
// [JsonDerivedType(typeof(FunctionApprovalResponseContent), typeDiscriminator: "functionApprovalResponse")]
// [JsonDerivedType(typeof(McpServerToolCallContent), typeDiscriminator: "mcpServerToolCall")]
// [JsonDerivedType(typeof(McpServerToolResultContent), typeDiscriminator: "mcpServerToolResult")]
// [JsonDerivedType(typeof(McpServerToolApprovalRequestContent), typeDiscriminator: "mcpServerToolApprovalRequest")]
// [JsonDerivedType(typeof(McpServerToolApprovalResponseContent), typeDiscriminator: "mcpServerToolApprovalResponse")]
// [JsonDerivedType(typeof(CodeInterpreterToolCallContent), typeDiscriminator: "codeInterpreterToolCall")]
// [JsonDerivedType(typeof(CodeInterpreterToolResultContent), typeDiscriminator: "codeInterpreterToolResult")]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace Microsoft.Extensions.AI;
/// Represents a function call request.
/// </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
[JsonDerivedType(typeof(McpServerToolCallContent), "mcpServerToolCall")]
public class FunctionCallContent : AIContent
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace Microsoft.Extensions.AI;
/// Represents the result of a function call.
/// </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
[JsonDerivedType(typeof(McpServerToolResultContent), "mcpServerToolResult")]
public class FunctionResultContent : AIContent
Comment thread
stephentoub marked this conversation as resolved.
Outdated
{
/// <summary>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
using Microsoft.Shared.DiagnosticIds;
using Microsoft.Shared.Diagnostics;

Expand All @@ -17,40 +17,26 @@ namespace Microsoft.Extensions.AI;
/// It is informational only.
/// </remarks>
[Experimental(DiagnosticIds.Experiments.AIMcpServers, UrlFormat = DiagnosticIds.UrlFormat)]
public sealed class McpServerToolCallContent : AIContent
public sealed class McpServerToolCallContent : FunctionCallContent
{
/// <summary>
/// Initializes a new instance of the <see cref="McpServerToolCallContent"/> class.
Comment thread
jozkee marked this conversation as resolved.
/// </summary>
/// <param name="callId">The tool call ID.</param>
/// <param name="toolName">The tool name.</param>
/// <param name="name">The tool name.</param>
/// <param name="serverName">The MCP server name that hosts the tool.</param>
/// <exception cref="ArgumentNullException"><paramref name="callId"/> or <paramref name="toolName"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentException"><paramref name="callId"/> or <paramref name="toolName"/> is empty or composed entirely of whitespace.</exception>
public McpServerToolCallContent(string callId, string toolName, string? serverName)
/// <exception cref="ArgumentNullException"><paramref name="callId"/> or <paramref name="name"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentException"><paramref name="callId"/> or <paramref name="name"/> is empty or composed entirely of whitespace.</exception>
[JsonConstructor]
Comment thread
jozkee marked this conversation as resolved.
Outdated
public McpServerToolCallContent(string callId, string name, string? serverName)
: base(Throw.IfNullOrWhitespace(callId), Throw.IfNullOrWhitespace(name))
Comment thread
jozkee marked this conversation as resolved.
{
CallId = Throw.IfNullOrWhitespace(callId);
ToolName = Throw.IfNullOrWhitespace(toolName);
ServerName = serverName;
InvocationRequired = false;
}

/// <summary>
/// Gets the tool call ID.
/// </summary>
public string CallId { get; }

/// <summary>
/// Gets the name of the tool called.
/// </summary>
public string ToolName { get; }

/// <summary>
/// Gets the name of the MCP server that hosts the tool.
/// </summary>
public string? ServerName { get; }

/// <summary>
/// Gets or sets the arguments used for the tool call.
/// </summary>
public IReadOnlyDictionary<string, object?>? Arguments { get; set; }
}
Loading
Loading