Describe the bug
When using MCPToolset with MongoDB MCP in an LlmAgent, some function parameters have enum values that are integers (e.g., [256, 512, 1024, ...]) while the schema specifies type: string. This causes google.genai.errors.ClientError: 400 INVALID_ARGUMENT when the agent is loaded or tools are called, with messages like:
Invalid value at 'tools[0].function_declarations[13].parameters.properties[2].value.items.any_of[1].properties[0].value.properties[7].value.properties[0].value.enum[0]' (TYPE_STRING), 256
To Reproduce
Steps to reproduce the behavior:
- Install the latest
google-adk and 'MongoDB mcp server'
- Start the MongoDB MCP server before running the agent:
npx -y mongodb-mcp-server \
--connectionString "mongodb://localhost:27018?directConnection=true" \
--transport http \
--httpHost=0.0.0.0 \
--httpPort=8080
- Create an agent using MongoDB MCP:
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))]
)
- Run
adk web . from the agent folder.
- Observe errors related to
TYPE_STRING and enum integer values.
Expected behavior
Integer enum values returned by MongoDB MCP should either:
- Be automatically cast to strings when the schema type is
string, or
- The schema itself should use
type: integer, so ADK can validate properly.
Desktop
- OS: macOS 13.5
- Python version: 3.13
- ADK version: [latest]
Model Information:
- Using LiteLLM: No
- Model: gemini-2.5-flash
Additional context
This breaks integration of MongoDB MCP with LlmAgent in ADK. Guidance on proper schema handling or automatic enum type normalization is needed.

Describe the bug
When using
MCPToolsetwith MongoDB MCP in anLlmAgent, some function parameters haveenumvalues that are integers (e.g.,[256, 512, 1024, ...]) while the schema specifiestype: string. This causesgoogle.genai.errors.ClientError: 400 INVALID_ARGUMENTwhen the agent is loaded or tools are called, with messages like:To Reproduce
Steps to reproduce the behavior:
google-adkand 'MongoDB mcp server'npx -y mongodb-mcp-server \ --connectionString "mongodb://localhost:27018?directConnection=true" \ --transport http \ --httpHost=0.0.0.0 \ --httpPort=8080adk web .from the agent folder.TYPE_STRINGand enum integer values.Expected behavior
Integer enum values returned by MongoDB MCP should either:
string, ortype: integer, so ADK can validate properly.Desktop
Model Information:
Additional context
This breaks integration of MongoDB MCP with LlmAgent in ADK. Guidance on proper schema handling or automatic enum type normalization is needed.