#Gemini Function calling property field violation

5 messages · Page 1 of 1 (latest)

proper hatch
#

I use the DuckDuckGo MCP server and the 'DuckDuckGo_search' function has as property the following format:

"max_results": {
  "default": 10,
  "title": "Max Results",
  "type": "integer"
}

which gives me a 400 Error: Bad Request with a field violation for the 'default' field.
It seems that Gemini is not compatible with that kind of JSON schema.
Is it possible to allow that schema, because many other MCP servers has this schema too.

Since MCP is becoming a standard protocol it would be nice that the Anthropic JSON schema used would be compatible too.

Thank you

dire ibex
#

Can you share more about where / how you're using this?

proper hatch
# dire ibex Can you share more about where / how you're using this?

Hey @dire ibex , thank you for catching up.
It is used in a VS Code extension, specifically in Cody. I want to implement MCP server use for BYOK users in agent mode. There are several LLMs available and the same JSON schema works flawlessly with the Anthropic models natively. Now that I want to support more models especially the compatible Google Gemini model family and later third-party vendors like OpenRouter, TogetherAI, etc, it seems that I need a JSON schema transformation for the Gemini models.
I followed the instruction given in the API docs https://ai.google.dev/gemini-api/docs/function-calling?example=weather#use_model_context_protocol_mcp and hit the 400 Bad format.
Thank you.

proper hatch
#

BTW: I used FastMCP to implement my custom MCP server.

dire ibex
#

hrm, this feels like it might be a better question for the google developer community discord instead