-
Notifications
You must be signed in to change notification settings - Fork 3.8k
.Net: Bug: Failed to serialize arguments to Json #11600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @mhackermsft, Semantic Kernel 1.46.0 is built against the ModelContextProtocol .01.0-Preview.8 nuget package. SK was just updated to the latest ModelContextProtocol .01.0-Preview.9 today - #11582. We may release a new SK version either at the end of this week or early next week. Meanwhile, to get unblocked, consider downgrading to the ModelContextProtocol .01.0-Preview.8 nuget package. |
I downgraded to the ModelContextProtocol .01.0-Preview.8 nuget package but I am still getting the same error: Microsoft.SemanticKernel.KernelFunction[0] |
Hi @mhackermsft, please try downgrading to the ModelContextProtocol.01.0-Preview.7 NuGet package. If that does not work, could you please create a console app that reproduces this issue, as it is not reproducible on our side? |
downgrading to 7 didn't resolve the issue. I have a demo that reproduces the issue consistently at: https://github.com/mhackermsft/SKMCPDemo.
The MCPClient project attempts to use a Playwright MCP server from: https://github.com/executeautomation/mcp-playwright Downgrading the ModelContextProtocol version does not resolve the issue. trce: Microsoft.SemanticKernel.KernelFunction[0] |
### Motivation and Context Fixes the issue of function arguments serialization of SK functions created from functions of `M.E.AI.AIFunction` type. Fixes: #11600
Describe the bug
Exact same issue as #11511 but the issue is not resolved by using a specific SK or Microsoft.Extensions.AI package.
I am running into the exact same issue with Semantic Kernel 1.46.0 and ModelContextProtocol .01.0-Preview.9. I have the Microsoft.Extensions.AI 9.4.0-preview.1.25207.5 installed.
Error message:
Microsoft.SemanticKernel.KernelFunction[0]
Function playwright-playwright_get arguments: Failed to serialize arguments to Json
System.NotSupportedException: JsonTypeInfo metadata for type 'Microsoft.SemanticKernel.KernelArguments' 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.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
at System.Text.Json.JsonSerializerOptions.GetTypeInfo(Type type)
at Microsoft.SemanticKernel.KernelFunctionLogMessages.LogFunctionArgumentsInternal(ILogger logger, String pluginName, String functionName, KernelArguments arguments, JsonSerializerOptions jsonSerializerOptions)
Seeing similar message with another MCP server:
Microsoft.SemanticKernel.KernelFunction[0]
Function spotify-SpotifyPlayback arguments: Failed to serialize arguments to Json
System.NotSupportedException: JsonTypeInfo metadata for type 'Microsoft.SemanticKernel.KernelArguments' 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.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
at System.Text.Json.JsonSerializerOptions.GetTypeInfo(Type type)
at Microsoft.SemanticKernel.KernelFunctionLogMessages.LogFunctionArgumentsInternal(ILogger logger, String pluginName, String functionName, KernelArguments arguments, JsonSerializerOptions jsonSerializerOptions)
Here are my project references:
all runtime; build; native; contentfiles; analyzers; buildtransitiveExpected behavior
The tool is successfully called and the LLM can use it to generate a response.
Platform
The text was updated successfully, but these errors were encountered: