I’m getting a [400 Bad Request] Invalid JSON payload received. Unknown name “type” at 'tools[0].function_declaration.parameters error when using the MCP Client Tool with Google Gemini 2.5 Flash model in n8n.
Setup Details
n8n Version: 1.107.4
Nodes Used:
MCP Client Tool (v1.1)
Google Gemini Chat Model (v1)
AI Agent (v2.2)
Superset-mcp Server: Custom Python server using FastMCP
Endpoint: SSE connection
Error Details
When I ask the AI Agent to “list all the tools”, the workflow fails with:
[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent:
[400 Bad Request] Invalid JSON payload received. Unknown name “type” at 'tools[0].function_declaration.parameters field is not an object
Please share your workflow
{
“nodes”: [
{
“parameters”: {
“public”: true,
“options”: {}
},
“id”: “a245eadb-4871-4120-a1ba-090e0ade504b”,
“name”: “When chat message received”,
“type”: “@n8n/n8n-nodes-langchain.chatTrigger”,
“position”: [
-400,
-16
],
“webhookId”: “52f72bbb-7d9e-443a-bb9f-75c43ef78e64”,
“typeVersion”: 1.3,
“alwaysOutputData”: false
},
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $json.chatInput }}”,
“options”: {
“systemMessage”: “=You are an AI assistant with access to Superset tools via mcp client tool. When listing tools, first call the mcp client tool to see what’s available, then provide a formatted list. Handle any schema errors gracefully.”
}
},
“id”: “aeb41737-df95-46c7-ab45-5bf3c2ddebd1”,
“name”: “AI Agent”,
“type”: “@n8n/n8n-nodes-langchain.agent”,
“position”: [
-96,
-16
],
“typeVersion”: 2.2
},
{
“parameters”: {
“options”: {
“temperature”: 0.7
}
},
“id”: “e367cc4c-aed6-4c28-b4d5-0d06309d0235”,
“name”: “Google Gemini Chat Model”,
“type”: “@n8n/n8n-nodes-langchain.lmChatGoogleGemini”,
“position”: [
-256,
192
],
“typeVersion”: 1,
“credentials”: {
“googlePalmApi”: {
“id”: “jCSpZhiYIwOXgUDx”,
“name”: “Google Gemini(PaLM) Api account 2”
}
}
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ $json.sessionId }}”,
“contextWindowLength”: 20
},
“id”: “33270cb3-4ed9-4067-9909-ebc2bbf4b56b”,
“name”: “Simple Memory”,
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“position”: [
-96,
208
],
“typeVersion”: 1.3
},
{
“parameters”: {
“endpointUrl”: “http://10.0.16.108:8089/sse”
},
“id”: “bd696515-5d09-4ffd-8337-b7f509875b76”,
“name”: “MCP Client”,
“type”: “@n8n/n8n-nodes-langchain.mcpClientTool”,
“position”: [
80,
208
],
“typeVersion”: 1.1
}
],
“connections”: {
“When chat message received”: {
“main”: [
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“Google Gemini Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Simple Memory”: {
“ai_memory”: [
[
{
“node”: “AI Agent”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“MCP Client”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “222b2f481627b103dedd725016ff99afa115f2d6484c23426f38ae8f5c9d3147”
}
}
Share the output returned by the last node
Bad request - please check your parameters
[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent: [400 Bad Request] Invalid JSON payload received. Unknown name “type” at ‘tools[0].function_declarations[3].parameters.properties[0].value’: Proto field is not repeating, cannot start list. Invalid JSON payload received. Unknown name “type” at ‘tools[0].function_declarations[3].parameters.properties[1].value’: Proto field is not repeating, cannot start list. [{“@type”:“type.googleapis.com/google.rpc.BadRequest",“fieldViolations”:[{“field”:“tools[0].function_declarations[3].parameters.properties[0].value”,“description”:"Invalid JSON payload received. Unknown name “type” at ‘tools[0].function_declarations[3].parameters.properties[0].value’: Proto field is not repeating, cannot start list.”},{“field”:“tools[0].function_declarations[3].parameters.properties[1].value”,“description”:“Invalid JSON payload received. Unknown name “type” at ‘tools[0].function_declarations[3].parameters.properties[1].value’: Proto field is not repeating, cannot start list.”}]}]