microsoft / microsoft/foundry-dev-tools

Deepseek custom model fails with MCP tool calls due to array-based message.content

Open
#264 1 comment 0 reactions 1 assignee View on GitHub

@a1exwang is already working on this.

Since Sep 16, 2025.

feature request
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:

  1. Add agent with MCP (e.g., browser tool)
  2. Configure custom model pointing to Deepseek chat endpoint
  3. Trigger tool invocation
  4. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.