Skip to content

Commit bcb55b4

Browse files
.NET: Update A2A, MCP, and system package dependencies (microsoft#4647)
* .NET: Update A2A, MCP, and system package dependencies Update dependency versions: - A2A/A2A.AspNetCore: 0.3.3-preview → 0.3.4-preview - ModelContextProtocol: 0.8.0-preview.1 → 1.1.0 - Microsoft.Bcl.AsyncInterfaces: 10.0.3 → 10.0.4 - System.Linq.AsyncEnumerable: 10.0.0 → 10.0.4 - Add Microsoft.Bcl.Memory 10.0.4 Remove internal polyfill extensions now provided by A2A SDK 0.3.4: - A2AMetadataExtensions (source + tests) - AdditionalPropertiesDictionaryExtensions (source + tests) Update DefaultMcpToolHandler to match MCP SDK 1.1.0 API changes where ImageContentBlock.Data and AudioContentBlock.Data changed from string to ReadOnlyMemory<byte>. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * address pr review comments --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 921c5f9 commit bcb55b4

10 files changed

Lines changed: 168 additions & 614 deletions

File tree

dotnet/Directory.Packages.props

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333
<!-- Newtonsoft.Json -->
3434
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
3535
<!-- System.* -->
36-
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.3" />
36+
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.4" />
3737
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
38+
<PackageVersion Include="Microsoft.Bcl.Memory" Version="10.0.4" />
3839
<PackageVersion Include="System.ClientModel" Version="1.9.0" />
3940
<PackageVersion Include="System.CodeDom" Version="10.0.0" />
4041
<PackageVersion Include="System.Collections.Immutable" Version="10.0.1" />
4142
<PackageVersion Include="System.CommandLine" Version="2.0.0-rc.2.25502.107" />
4243
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="10.0.3" />
43-
<PackageVersion Include="System.Linq.AsyncEnumerable" Version="10.0.0" />
44+
<PackageVersion Include="System.Linq.AsyncEnumerable" Version="10.0.4" />
4445
<PackageVersion Include="System.Net.Http.Json" Version="10.0.0" />
4546
<PackageVersion Include="System.Net.ServerSentEvents" Version="10.0.3" />
4647
<PackageVersion Include="System.Text.Json" Version="10.0.3" />
@@ -101,10 +102,10 @@
101102
<PackageVersion Include="Microsoft.Agents.Authentication.Msal" Version="1.3.171-beta" />
102103
<PackageVersion Include="Microsoft.Agents.Hosting.AspNetCore" Version="1.3.171-beta" />
103104
<!-- A2A -->
104-
<PackageVersion Include="A2A" Version="0.3.3-preview" />
105-
<PackageVersion Include="A2A.AspNetCore" Version="0.3.3-preview" />
105+
<PackageVersion Include="A2A" Version="0.3.4-preview" />
106+
<PackageVersion Include="A2A.AspNetCore" Version="0.3.4-preview" />
106107
<!-- MCP -->
107-
<PackageVersion Include="ModelContextProtocol" Version="0.8.0-preview.1" />
108+
<PackageVersion Include="ModelContextProtocol" Version="1.1.0" />
108109
<!-- Inference SDKs -->
109110
<PackageVersion Include="AWSSDK.Extensions.Bedrock.MEAI" Version="4.0.5.1" />
110111
<PackageVersion Include="Microsoft.ML.OnnxRuntimeGenAI" Version="0.10.0" />

dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2AMetadataExtensions.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.

dotnet/src/Microsoft.Agents.AI.A2A/Extensions/AdditionalPropertiesDictionaryExtensions.cs

Lines changed: 0 additions & 44 deletions
This file was deleted.

dotnet/src/Microsoft.Agents.AI.Hosting.A2A/Converters/A2AMetadataExtensions.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.

dotnet/src/Microsoft.Agents.AI.Hosting.A2A/Converters/AdditionalPropertiesDictionaryExtensions.cs

Lines changed: 0 additions & 44 deletions
This file was deleted.

dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.Mcp/DefaultMcpToolHandler.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Globalization;
66
using System.Linq;
77
using System.Net.Http;
8+
using System.Text;
89
using System.Threading;
910
using System.Threading.Tasks;
1011
using Microsoft.Extensions.AI;
@@ -222,31 +223,36 @@ private static void PopulateResultContent(McpServerToolResultContent resultConte
222223
}
223224
}
224225

225-
private static AIContent ConvertContentBlock(ContentBlock block)
226+
internal static AIContent ConvertContentBlock(ContentBlock block)
226227
{
227228
return block switch
228229
{
229230
TextContentBlock text => new TextContent(text.Text),
230-
ImageContentBlock image => CreateDataContentFromBase64(image.Data, image.MimeType ?? "image/*"),
231-
AudioContentBlock audio => CreateDataContentFromBase64(audio.Data, audio.MimeType ?? "audio/*"),
231+
ImageContentBlock image => CreateDataContent(image.Data, image.MimeType ?? "image/*"),
232+
AudioContentBlock audio => CreateDataContent(audio.Data, audio.MimeType ?? "audio/*"),
232233
_ => new TextContent(block.ToString() ?? string.Empty),
233234
};
234235
}
235236

236-
private static DataContent CreateDataContentFromBase64(string? base64Data, string mediaType)
237+
private static DataContent CreateDataContent(ReadOnlyMemory<byte> base64Utf8Data, string mediaType)
237238
{
238-
if (string.IsNullOrEmpty(base64Data))
239+
if (base64Utf8Data.IsEmpty)
239240
{
240241
return new DataContent($"data:{mediaType};base64,", mediaType);
241242
}
242243

244+
#if NET8_0_OR_GREATER
245+
string base64 = Encoding.UTF8.GetString(base64Utf8Data.Span);
246+
#else
247+
string base64 = Encoding.UTF8.GetString(base64Utf8Data.ToArray());
248+
#endif
249+
243250
// If it's already a data URI, use it directly
244-
if (base64Data.StartsWith("data:", StringComparison.OrdinalIgnoreCase))
251+
if (base64.StartsWith("data:", StringComparison.OrdinalIgnoreCase))
245252
{
246-
return new DataContent(base64Data, mediaType);
253+
return new DataContent(base64, mediaType);
247254
}
248255

249-
// Otherwise, construct a data URI from the base64 data
250-
return new DataContent($"data:{mediaType};base64,{base64Data}", mediaType);
256+
return new DataContent($"data:{mediaType};base64,{base64}", mediaType);
251257
}
252258
}

dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Extensions/A2AMetadataExtensionsTests.cs

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)