Official MCP Python SDK adapters for Gemini/OpenAI/Claude tool schemas?
Are there official adapter functions in the MCP Python SDK for converting tool schemas to Gemini, OpenAI, or Claude formats? I am building an MCP client and Gemini rejects schemas with optional parameters with a generic INVALID REQUEST error, while OpenAI and Ollama work. What is the currently supported way to handle provider-specific schema quirks?
Originally asked on GitHub: https://github.com/modelcontextprotocol/python-sdk/issues/235
5 answers
The issue is still open, but the maintainer position (October 2025) is that the Python SDK should not take on the maintenance burden of adapters for third-party LLM SDKs; those SDKs are better placed to provide MCP integration. Instead, the SDK should make writing such adapters easy, with documentation and examples. A community PR (#1709) follows that direction and adds a docs/llm-adapters.md guide covering Gemini, OpenAI, and Claude adapters, plus a runnable example in examples/snippets/clients/, but as of February 2026 it still needs a rebase and cleanup before landing. For now, the practical workaround is to write your own per-provider adapter. The issue body includes a sample to_gemini_tool function that maps mcp_types.Tool.name, description, and inputSchema into a Gemini function declaration, including required parameters and property type/description conversion. Note that Gemini accepts only a small subset of JSON Schema while MCP schemas can use the full range, so arbitrary MCP schemas may need simplification, especially around optional parameters and unsupported keywords. One host-level workaround mentioned in the thread is Cline, which avoids Gemini validation issues by sending the tool payload in the message field instead of the dedicated tools field, though that was described with some uncertainty.
Did this work for you?What @dgenio tried on GitHub (Partly worked)
Opened PR #1709 with documentation and runnable examples for Gemini, OpenAI, and Claude adapters, following the maintainer's guidance. The core content is ready but the PR needs rebase and cleanup.
Did this work for you?What @wtfzambo tried on GitHub (Didn't work)
Built a simple MCP client using the OpenAI SDK and found OpenAI and Ollama worked, but Gemini rejected schemas with optional parameters, returning only INVALID REQUEST.
Did this work for you?What @wtfzambo tried on GitHub (Outcome unclear)
Reported that Cline avoids Gemini schema issues by putting the tools payload in the message field rather than the dedicated tools field, though this was described as a tentative understanding.
Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
Proposed adding official adapter functions to the MCP Python SDK and included sample to_gemini_tool conversion code based on mcp_types.Tool.
Source: https://github.com/modelcontextprotocol/python-sdk/issues/235 (opens external site)
Did this work for you?
Related questions
- MCP python-sdk simple-chatbot: 'Attempted to exit cancel scope in a different task than it was entered in'
- Why is my MCP resource template (greeting://{name}) not available in Claude Desktop?
- How to disable TLS certificate verification (verify=False) in MCP streamablehttp_client?
- anyio.ClosedResourceError in MCP StreamableHTTP message router on fast-failing requests?
- Python MCP SDK streamable HTTP: 'Error in message router' ClosedResourceError after 307 redirect