API error when asking to list tools
Description of the bug:
I configured my MCP servers: https://github.com/GoogleCloudPlatform/cloud-run-mcp
I then ask Gemini CLI to list tools, and it seems like I get an API error:
> list tools
✕ [API Error: got status: 400 Bad Request. {"error":{"message":"{\n \"error\": {\n \"code\": 400,\n \"message\": \"Invalid JSON payload received. Unknown name \\\"additionalProperties\\\" at
'tools[0].function_declarations[11].parameters': Cannot find field.\\nInvalid JSON payload received. Unknown name \\\"$schema\\\" at 'tools[0].function_declarations[11].parameters': Cannot find
field.\\nInvalid JSON payload received. Unknown name \\\"additionalProperties\\\" at 'tools[0].function_declarations[12].parameters': Cannot find field.\\nInvalid JSON payload received. Unknown
name \\\"$schema\\\" at 'tools[0].function_declarations[12].parameters': Cannot find field.\\nInvalid JSON payload received. Unknown name \\\"additionalProperties\\\" at
'tools[0].function_declarations[13].parameters': Cannot find field.\\nInvalid JSON payload received. Unknown name \\\"$schema\\\" at 'tools[0].function_declarations[13].parameters': Cannot find
field.\\nInvalid JSON payload received. Unknown name \\\"additionalProperties\\\" at 'tools[0].function_declarations[14].parameters': Cannot find field.\\nInvalid JSON payload received. Unknown
name \\\"$schema\\\" at 'tools[0].function_declarations[14].parameters': Cannot find field.\\nInvalid JSON payload received. Unknown name \\\"additionalProperties\\\" at
'tools[0].function_declarations[15].parameters': Cannot find field.\\nInvalid JSON payload received. Unknown name \\\"$schema\\\" at 'tools[0].function_declarations[15].parameters': Cannot find
field.\\nInvalid JSON payload received. Unknown name \\\"additionalProperties\\\" at 'tools[0].function_declarations[16].parameters.properties[3].value.items': Cannot find field.\\nInvalid JSON
payload received. Unknown name \\\"additionalProperties\\\" at 'tools[0].function_declarations[16].parameters': Cannot find field.\\nInvalid JSON payload received. Unknown name \\\"$schema\\\" at
'tools[0].function_declarations[16].parameters': Cannot find field.\",\n \"status\": \"INVALID_ARGUMENT\",\n \"details\": [\n {\n \"@type\":
\"type.googleapis.com/google.rpc.BadRequest\",\n \"fieldViolations\": [\n {\n \"field\": \"tools[0].function_declarations[11].parameters\",\n \"description\":
\"Invalid JSON payload received. Unknown name \\\"additionalProperties\\\" at 'tools[0].function_declarations[11].parameters': Cannot find field.\"\n },\n {\n
\"field\": \"tools[0].function_declarations[11].parameters\",\n \"description\": \"Invalid JSON payload received. Unknown name \\\"$schema\\\" at
'tools[0].function_declarations[11].parameters': Cannot find field.\"\n },\n {\n \"field\": \"tools[0].function_declarations[12].parameters\",\n
\"description\": \"Invalid JSON payload received. Unknown name \\\"additionalProperties\\\" at 'tools[0].function_declarations[12].parameters': Cannot find field.\"\n },\n {\n
\"field\": \"tools[0].function_declarations[12].parameters\",\n \"description\": \"Invalid JSON payload received. Unknown name \\\"$schema\\\" at
'tools[0].function_declarations[12].parameters': Cannot find field.\"\n },\n {\n \"field\": \"tools[0].function_declarations[13].parameters\",\n
\"description\": \"Invalid JSON payload received. Unknown name \\\"additionalProperties\\\" at 'tools[0].function_declarations[13].parameters': Cannot find field.\"\n },\n {\n
\"field\": \"tools[0].function_declarations[13].parameters\",\n \"description\": \"Invalid JSON payload received. Unknown name \\\"$schema\\\" at
'tools[0].function_declarations[13].parameters': Cannot find field.\"\n },\n {\n \"field\": \"tools[0].function_declarations[14].parameters\",\n
\"description\": \"Invalid JSON payload received. Unknown name \\\"additionalProperties\\\" at 'tools[0].function_declarations[14].parameters': Cannot find field.\"\n },\n {\n
\"field\": \"tools[0].function_declarations[14].parameters\",\n \"description\": \"Invalid JSON payload received. Unknown name \\\"$schema\\\" at
'tools[0].function_declarations[14].parameters': Cannot find field.\"\n },\n {\n \"field\": \"tools[0].function_declarations[15].parameters\",\n
\"description\": \"Invalid JSON payload received. Unknown name \\\"additionalProperties\\\" at 'tools[0].function_declarations[15].parameters': Cannot find field.\"\n },\n {\n
\"field\": \"tools[0].function_declarations[15].parameters\",\n \"description\": \"Invalid JSON payload received. Unknown name \\\"$schema\\\" at
'tools[0].function_declarations[15].parameters': Cannot find field.\"\n },\n {\n \"field\":
\"tools[0].function_declarations[16].parameters.properties[3].value.items\",\n \"description\": \"Invalid JSON payload received. Unknown name \\\"additionalProperties\\\" at
'tools[0].function_declarations[16].parameters.properties[3].value.items': Cannot find field.\"\n },\n {\n \"field\":
\"tools[0].function_declarations[16].parameters\",\n \"description\": \"Invalid JSON payload received. Unknown name \\\"additionalProperties\\\" at
'tools[0].function_declarations[16].parameters': Cannot find field.\"\n },\n {\n \"field\": \"tools[0].function_declarations[16].parameters\",\n
\"description\": \"Invalid JSON payload received. Unknown name \\\"$schema\\\" at 'tools[0].function_declarations[16].parameters': Cannot find field.\"\n }\n ]\n }\n ]\n
}\n}\n","code":400,"status":"Bad Request"}}]
Actual vs expected behavior:
No response
Any other information you'd like to share?
No response
@steren I looked into this (ran your MCP server) and you're sadly not going to like the reason why this is broken. The tools you're returning are valid json schema for Open AI, for Anthropic BUT not for Vertex / Gemini API. Gemini API doesn't support the full JSON schema syntax surprisingly. The two properties which end up breaking Vertex / Gemini are $schema and additionalProperties.
All that said, if we want to support MCP servers at Google AND Gemini for scenarios when folks aren't directly using the Gemini SDK this will need to be fixed at the API layer 😢 . Let me see if I can quickly build an adapter for GC at the very least.
@sasha-gitg @ivanlh is this a known limitation being tracked somewhere?
Here's the json stringified version of @steren's tools:
[
{
"name": "list-projects",
"description": "Lists available GCP projects",
"inputSchema": {
"type": "object"
}
},
{
"name": "create-project",
"description": "Creates a new GCP project and attempts to attach it to the first available billing account. A project ID can be optionally specified; otherwise it will be automatically generated.",
"inputSchema": {
"type": "object",
"properties": {
"projectId": {
"type": "string",
"description": "Optional. The desired ID for the new GCP project. If not provided, an ID will be auto-generated."
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
},
{
"name": "list-services",
"description": "Lists Cloud Run services in a given project and region.",
"inputSchema": {
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "Google Cloud project ID"
},
"region": {
"type": "string",
"description": "Region where the services are located",
"default": "europe-west1"
}
},
"required": [
"project"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
},
{
"name": "get-service",
"description": "Gets details for a specific Cloud Run service.",
"inputSchema": {
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "Google Cloud project ID containing the service"
},
"region": {
"type": "string",
"description": "Region where the service is located",
"default": "europe-west1"
},
"service": {
"type": "string",
"description": "Name of the Cloud Run service"
}
},
"required": [
"project",
"service"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
},
{
"name": "deploy-local-files",
"description": "Deploy local files to Cloud Run. Takes an array of absolute file paths from the local filesystem that will be deployed. Use this tool if the files exists on the user local filesystem.",
"inputSchema": {
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "Google Cloud project ID. Do not select it yourself, make sure the user provides or confirms the project ID."
},
"region": {
"type": "string",
"default": "europe-west1",
"description": "Region to deploy the service to"
},
"service": {
"type": "string",
"default": "app",
"description": "Name of the Cloud Run service to deploy to"
},
"files": {
"type": "array",
"items": {
"type": "string"
},
"description": "Array of absolute file paths to deploy (e.g. [\\"/home/user/project/src/index.js\\", \\"/home/user/project/package.json\\"])"
}
},
"required": [
"project",
"files"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
},
{
"name": "deploy-local-folder",
"description": "Deploy a local folder to Cloud Run. Takes an absolute folder path from the local filesystem that will be deployed. Use this tool if the entire folder content needs to be deployed.",
"inputSchema": {
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "Google Cloud project ID. Do not select it yourself, make sure the user provides or confirms the project ID."
},
"region": {
"type": "string",
"default": "europe-west1",
"description": "Region to deploy the service to"
},
"service": {
"type": "string",
"default": "app",
"description": "Name of the Cloud Run service to deploy to"
},
"folderPath": {
"type": "string",
"description": "Absolute path to the folder to deploy (e.g. \\"/home/user/project/src\\")"
}
},
"required": [
"project",
"folderPath"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
},
{
"name": "deploy-file-contents",
"description": "Deploy files to Cloud Run by providing their contents directly. Takes an array of file objects containing filename and content. Use this tool if the files only exist in the current chat context.",
"inputSchema": {
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "Google Cloud project ID. Leave unset for the app to be deployed in a new project. If provided, make sure the user confirms the project ID they want to deploy to."
},
"region": {
"type": "string",
"default": "europe-west1",
"description": "Region to deploy the service to"
},
"service": {
"type": "string",
"default": "app",
"description": "Name of the Cloud Run service to deploy to"
},
"files": {
"type": "array",
"items": {
"type": "object",
"properties": {
"filename": {
"type": "string",
"description": "Name and path of the file (e.g. \\"src/index.js\\" or \\"data/config.json\\")"
},
"content": {
"type": "string",
"description": "Text content of the file"
}
},
"required": [
"filename"
],
"additionalProperties": false
},
"description": "Array of file objects containing filename and content"
}
},
"required": [
"project",
"files"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
]
@pamorgan Do you have context here?
I'm using the official MCP server TypeScript library. It's like you that many would encounter the same issue.
yes, sad that we don't handle this on the API yet, but for now we can fix this in GC. i can do this later today. i also had to modify my schemas when using official server library in python
On Fri, May 16, 2025 at 10:07 PM Steren @.***> wrote:
steren left a comment (google-gemini/gemini-cli#398) https://github.com/google-gemini/gemini-cli/issues/398#issuecomment-2888087432
I'm using the official MCP server TypeScript library. It's like you that many would encounter the same issue.
— Reply to this email directly, view it on GitHub https://github.com/google-gemini/gemini-cli/issues/398#issuecomment-2888087432, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFWNPDCVIPFS7JDHIITEY32627ZDAVCNFSM6AAAAAB5KD22R2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQOBYGA4DONBTGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
looks like taylor did this already
On Sat, May 17, 2025 at 10:03 AM Olcan Sercinoglu @.***> wrote:
yes, sad that we don't handle this on the API yet, but for now we can fix this in GC. i can do this later today. i also had to modify my schemas when using official server library in python
On Fri, May 16, 2025 at 10:07 PM Steren @.***> wrote:
steren left a comment (google-gemini/gemini-cli#398) https://github.com/google-gemini/gemini-cli/issues/398#issuecomment-2888087432
I'm using the official MCP server TypeScript library. It's like you that many would encounter the same issue.
— Reply to this email directly, view it on GitHub https://github.com/google-gemini/gemini-cli/issues/398#issuecomment-2888087432, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFWNPDCVIPFS7JDHIITEY32627ZDAVCNFSM6AAAAAB5KD22R2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQOBYGA4DONBTGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
i can confirm this works, i no longer have to hack the schema in my python server