fix: Remove unconditional strict mode from MCP tool schemas #11098
+135
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
HTTP-type MCPs fail with
AI_APICallErrorbecause tool schemas are forced into OpenAI strict mode, which requires all properties to be marked as required—breaking tools with optional parameters.Changes
strict: truefrommcpToolsToOpenAIChatToolsandmcpToolsToOpenAIResponseToolsprocessSchemaForO3transformation that forces all properties into therequiredarrayExample
Before (breaks HTTP MCPs with optional params):
After (preserves original schema):
The
processSchemaForO3transformation was designed specifically for O3 models. If strict mode is needed for specific models in the future, it should be applied conditionally.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cdn.sheetjs.com/usr/local/bin/node /home/REDACTED/work/cherry-studio/cherry-studio/.yarn/releases/yarn-4.9.1.cjs install(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>[Bug]: In version 1.6.6, all HTTP-type MCPs cause model errors</issue_title>
<issue_description>> [!NOTE]
Issue Checklist
Platform
Windows
Version
v1.6.6
Bug Description
In version 1.6.6, all HTTP-type MCPs cause model errors. Loading any HTTP-type MCP causes model errors.
Steps To Reproduce
Load any HTTP-type MCP
Expected Behavior
Use MCP normally
Relevant Log Output
Additional Context
No response
Original Content
Issue Checklist
Platform
Windows
Version
v1.6.6
Bug Description
1.6.6 版本,所有http类型的MCP都会导致模型错误,加载任何 http类型的mcp都会让模型报错
Steps To Reproduce
加载任何 http类型的mcp