[Bug]: MongoDB MCP's schema has type: "string" with integer enum values [256, 512...], which Gemini rejects.
Opened this issue · 4 comments
Version
1.2.0
App
- Cursor
- Windsurf
- VSCode
- VSCode Insiders
- Claude Desktop
- Other
Affected Models (if applicable)
- Claude 3.5 Sonnet
- Claude 3.7 Sonnet
- GPT-4a
- o4-mini
- Other
Bug Description
Hi, so I am trying to integrate the mcp server with gemini. I host the server locally and integrate it with gemini using the google agent development kit.
However, MongoDB MCP's schema has type: "string" with integer enum values [256, 512...], which Gemini rejects.

Thanks for opening this issue. The ticket MCP-281 was created for internal tracking.
Hey @Ateeb626! Thank you for reporting this issue. From the stack trace its not entirely clear which tool schema is problematic here. Can you please mention which tool was invoked by Gemini which led to this error? Additionally it would be helpful to know what configuration the MCP server was running with (command line arguments / environment variables) so that we may try and reproduce this at our end.
Note: When providing the config, do not forget to redact the credentials.
Hey, so since I use the gemini toolset method, it loads all the tools so I can't clearly spot which tool is problematic either.
I start the MongoDB mcp server using this command
npx -y mongodb-mcp-server --connectionString "mongodb://localhost:27018?directConnection=true" --transport http --httpHost=0.0.0.0 --httpPort=8080
This loads all the following tools:
connect
list-collections
list-databases
collection-indexes
drop-index
create-index
collection-schema
find
insert-many
delete-many
collection-storage-size
count
db-stats
aggregate
update-many
rename-collection
drop-database
drop-collection
explain
create-collection
mongodb-logs
export
I then try to load all these tools in the google agent development kit with the code snippet
from google.adk.agents import LlmAgent
from google.adk.tools.mcp_tool import MCPToolset, StreamableHTTPConnectionParams
mcp_server_url = "http://127.0.0.1:8080/mcp"
root_agent = LlmAgent(
model="gemini-2.5-flash",
name="mongo_mcp_agent",
instruction="Help with MongoDB data access",
tools=[
MCPToolset(
connection_params=StreamableHTTPConnectionParams(
url=mcp_server_url,
)
)
]
)
Based on the enum values, it's very likely this is coming from aggregate, export, or explain. Looking at the json schema the server returns though, the outputDimension field is correctly defined as number - e.g. this is part of the schema for aggregate:
"embeddingParameters": {
"type": "object",
"properties": {
"outputDimension": {
"type": "number",
"enum": [
256,
512,
1024,
2048,
4096
],
"default": 1024
},
"outputDtype": {
"type": "string",
"enum": [
"float",
"int8",
"uint8",
"binary",
"ubinary"
],
"default": "float"
},
"model": {
"type": "string",
"enum": [
"voyage-3-large",
"voyage-3.5",
"voyage-3.5-lite",
"voyage-code-3"
],
"default": "voyage-3-large"
}
},
"additionalProperties": false,
"description": "The embedding model and its parameters to use to generate embeddings before searching. It is mandatory if queryVector is a string value. Note to LLM: If unsure, ask the user before providing one."
}It's not clear to me why those fields are being interpreted as strings in the gemini toolkit.