Skip to content

Conversation

ribelo
Copy link

@ribelo ribelo commented Jul 5, 2025

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.
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.

1 participant