-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
We are using SK together with some MCP Servers that we have running using ModelContextProtocol.AspNet. We use HttpTransport and the AsKernelFunction ExtensionMethod to add the Tools as plugins to SK. Since I have turned on the logging for SK we are seeing the following Errors in the Logs:
Function SomePlugin-SomeTool result: Failed to log function result value
System.NotSupportedException: JsonTypeInfo metadata for type 'Microsoft.Extensions.AI.TextContent' was not provided by TypeInfoResolver of type 'Microsoft.SemanticKernel.AbstractionsJsonContext'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.
at System.Text.Json.ThrowHelper.ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver resolver)
at System.Text.Json.JsonSerializerOptions.GetTypeInfoForRootType(Type type, Boolean fallBackToNearestAncestorType)
at System.Text.Json.JsonSerializerOptions.TryGetPolymorphicTypeInfoForRootType(Object rootValue, JsonTypeInfo& polymorphicTypeInfo)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Serialize(Utf8JsonWriter writer, T& rootValue, Object rootValueBoxed)
at System.Text.Json.JsonSerializer.WriteString[TValue](TValue& value, JsonTypeInfo`1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonTypeInfo`1 jsonTypeInfo)
at Microsoft.SemanticKernel.KernelFunctionLogMessages.LogFunctionResultValueInternal(ILogger logger, String pluginName, String functionName, FunctionResult resultValue, JsonSerializerOptions jsonSerializerOptions)Since this is only on the logging side and has no effect on the execution, this isn't that bad, but I though it's a good idea to report it here.
To Reproduce
Steps to reproduce the behavior:
- Setup SK, use ModelContextProtocol package
- use
McpClient.ListToolsAsync()to get the tools - on each tool use
.AsKernelFunction() - add them to a plugin
- add the plugin to the kernel
- Turn of SK logging in the appsettings
- use the llm to make calls to the tool
Expected behavior
Serialization and logging works
Platform
- Language: c#
- Source: 1.73.0
- AI model: Azure OpenAI, GPT 5.2
- IDE: Any / running from Docker
- OS: Linux (Containered Version)
Additional Info
ModelContextProtocol(.AspNetCore)-Nuget Version: 1.1.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working