Conversation
| // Other MCP Types | ||
| [JsonSerializable(typeof(IDictionary<string, object>))] | ||
| [JsonSerializable(typeof(IReadOnlyDictionary<string, object>))] | ||
| [JsonSerializable(typeof(List<object>))] |
There was a problem hiding this comment.
Do we know which MEAI provider produces List<object> here? FunctionInvokingChatClient forwards the provider's arguments unchanged, and MEAI's OpenAI adapter parses JSON arrays as JsonElement, which we already handle. This test constructs List<object> directly, so it doesn't establish that this is a general MEAI array gap. Could we identify the provider and cover its path?
There was a problem hiding this comment.
Found tryAGI/Ollama: ConvertJsonValue in OllamaClient.ChatClient.cs uses .ToList() for JSON arrays. The same reporter filed tryAGI/Ollama#215 for read_multiple_files. Added real-provider AOT coverage through FunctionInvokingChatClient and MCP; removing the registration fails the new test, and Release/Debug pass with it.
— girishkvs's Copilot 🤖
af89abb to
24b405e
Compare
Fixes #1846
Problem
Providers that produce CLR
List<object>tool arguments can fail under Native AOT because the default MCP serializer context lacks metadata for that type.tryAGI/Ollamais a concrete producer: its MEAI adapter converts JSON arrays using.ToList(). The same reporter filed tryAGI/Ollama#215 for the sameread_multiple_filesscenario. This does not affect every array representation:JsonElementarguments already pass through without this conversion.Change
Keep the
List<object>registration inMcpJsonUtilities.JsonContextand the direct populated/empty-list checks.Add
OllamaProviderArrayRegressionto the existing AOT compatibility app. The real publishedOllama1.15.2-dev.5 SDK reads mock JSON/NDJSON responses and supplies the arguments throughFunctionInvokingChatClientto the existing MCPJoin(string[] items)tool. The test checks the provider-created type, unchanged argument reference and actual tool result; it does not manufacture the provider's list.Validation
The current AOT compatibility app was published through
MSBuild.exeusing SDK 10.0.401, with/t:Publish,/p:RuntimeIdentifier=win-x64and/p:SelfContained=true, then its native executable was run. SourceLink matchesmainat 10.0.401; NuGet audits remain enabled.List<object>missing-metadata exception through the provider/FICC/MCP pathThe cases cover streaming/non-streaming and populated/empty arrays. Each also checks the existing
JsonElementpath. MCP Core builds fornetstandard2.0,net8.0,net9.0andnet10.0;git diff --checkpasses.No live provider calls or model downloads are needed. The regression stops after the MCP tool invocation; it does not claim to fix the provider's separate tool-result serialization behavior. Other OS native builds and the full repository test suite were not run locally.