Skip to content

MCP tool schema transformation for OpenAI/Azure providers - #712

Closed
ribelo wants to merge 2 commits into
anomalyco:devfrom
ribelo:fix/mcp-schema-transformation
Closed

ribelo wants to merge 2 commits into
anomalyco:devfrom
ribelo:fix/mcp-schema-transformation

Conversation

@ribelo

@ribelo ribelo commented Jul 5, 2025 •

Copy link
Copy Markdown
Contributor

Fixes MCP tools failing with OpenAI/Azure providers due to schema compatibility
issues.

Resolves:

Changes:

  • Transform MCP tool schemas to make optional parameters nullable + required for
    OpenAI/Azure
  • Move transformation logic to MCP module for cleaner architecture
  • Graceful fallback for complex schemas

Tested with: context7-mcp, works with OpenAI models

Fixes schema compatibility issues where MCP tools fail with OpenAI/Azure
providers due to missing required parameter transformations.

Changes:
- Move transformation logic from session to MCP.tools() for better architecture
- Add transformJsonSchema() to handle simple object schemas with optional→nullable conversion
- Transform AI SDK's parameters.jsonSchema structure for OpenAI/Azure compatibility
- Add graceful fallback for complex schemas (oneOf, anyOf, etc.)
- Preserve error handling with fallback to original tools

This ensures MCP tools like context7 and clojure-mcp work seamlessly with
OpenAI/Azure providers while maintaining compatibility with other providers.
@ribelo
ribelo force-pushed the fix/mcp-schema-transformation branch from 7dcac56 to 81a110c Compare September 12, 2025 12:10
@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions Bot closed this Feb 2, 2026
bussard76 pushed a commit to bussard76/openwork that referenced this pull request May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants