microsoft / microsoft/foundry-dev-tools
Deepseek custom model fails with MCP tool calls due to array-based message.content
@a1exwang is already working on this.
Since Sep 16, 2025.
- Dominant language
- JavaScript
- Stars
- 2.1k
- Forks
- 260
- Avg merge
- 42m
- Merged PRs (30d)
- 29
Description
When using a custom Deepseek chat model in AI Toolkit with MCP enabled, each time a tool call (e.g. browser open) occurs, the subsequent model request fails:
Error:
400 Failed to deserialize the JSON body into the target type: messages[1]: invalid type: sequence, expected a string
Root Cause:
The request payload uses an OpenAI "content parts" array for messages:
"content": [
{ "type": "text", "text": "Open the browser" },
{ "type": "text", "text": "Tool result ..." }
]
Deepseek API expects:
"content": "Open the browser\nTool result ..."
Requested Fix:
Add model-specific serialization or a compatibility flag to flatten multi-part content arrays into a single string when invoking non-OpenAI providers (e.g., Deepseek).
Reproduction Steps:
- Add agent with MCP (e.g., browser tool)
- Configure custom model pointing to Deepseek chat endpoint
- Trigger tool invocation
- Observe 400 error above
Environment:
- AI Toolkit version: x.y.z
- VS Code version: ...
- OS: ...
- Deepseek endpoint: ...
Please let me know if additional logs are needed.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.