Open
Description
Describe the bug
Function calling using MCP is not using the specified JsonSerializerOptions
, and it's breaking the json being sent to MCP servers.
To Reproduce
Steps to reproduce the behavior:
- Clone https://github.com/carlos-ferreira/SemanticKernel.MCP.BrokenJson and open the project in Visual Studio
- Set your API key for OpenAI.
- Run the console app.
- Look at the immediate window
- You'll notice json being sent via when the
edit_tool
is called that is not a valid json, something like this:
{
"Id": "vvyRL797xP5bUSNd5zWIEEmZlZhPHFfG",
"PluginName": "Files",
"FunctionName": "edit_file",
"Arguments": {
"path": "D:\\AI\\Instructions\\Journals\\tasklist.md",
"edits": [{\u0022oldText\u0022:\u0022- Go to the bank \u0022,\u0022newText\u0022:\u0022- [ ] Go to the bank \\n\u0022},{\u0022oldText\u0022:\u0022 Send daily standup email\u0022,\u0022newText\u0022:\u0022 - [ ] Send daily standup email\\n\u0022}],
"dryRun": false
}
}
Expected behavior
The edit_tool
tool calls should produce json, similar to this one:
{
"Id": "vvyRL797xP5bUSNd5zWIEEmZlZhPHFfG",
"PluginName": "Files",
"FunctionName": "edit_file",
"Arguments": {
"path": "D:\\AI\\Instructions\\Journals\\tasklist.md",
"edits": [{"oldText":"- Go to the bank ","newText":"- [ ] Go to the bank \\n"},{"oldText":" Send daily standup email","newText":" - [ ] Send daily standup email\\n"}],
"dryRun": false
}
}
Screenshots
Platform
- Language: C#
- Source: NuGet package version 1.57.0, ModelContextProtocol 0.0.1-preview-17
- AI model: gpt-4o-mini
- IDE: Visual Studio 2022
- OS: Windows 11 Pro fully updated.
Metadata
Metadata
Assignees
Type
Projects
Status
Bug