Skip to content

400 “FunctionDeclaration … maximum allowed nesting depth” on every prompt when Notion MCP is enabled #5923

@nahyeongjin1

Description

@nahyeongjin1

What happened?

Summary

gemini fails for every conversation prompt with a 400 error when the Notion MCP server is enabled. As soon as I disable that MCP entry in settings.json, the CLI works normally again.


Observed error

╭────────╮
│ > hi │
╰────────╯

✕ [API Error: {"error":{"message":"{\n "error": {\n "code": 400,\n "message": "A FunctionDeclaration in the request exceeds the maximum allowed
nesting depth.",\n "status": "INVALID_ARGUMENT"\n }\n}\n","code":400,"status":"Bad Request"}}]

╭───────────╮
│ > hello │
╰───────────╯

✕ [API Error: {"error":{"message":"{\n "error": {\n "code": 400,\n "message": "A FunctionDeclaration in the request exceeds the maximum allowed
nesting depth.",\n "status": "INVALID_ARGUMENT"\n }\n}\n","code":400,"status":"Bad Request"}}]


Minimal settings excerpt (before)

{
  "mcpServers": {
    "notionMCP": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.notion.com/mcp"]
    }
  }
}

Workaround (after)

Commenting out or removing just the Notion MCP entry makes the CLI work again:

{
  "mcpServers": {
    // "notionMCP": {
    //   "command": "npx",
    //   "args": ["-y", "mcp-remote", "https://mcp.notion.com/mcp"]
    // }
  }
}

What did you expect to happen?

Prompts should succeed even with Notion MCP enabled.

Client information

  • CLI Version: 0.1.18-nightly.250810.c632ec8b
  • Git Commit: c632ec8
  • Operating System: linux v20.19.3
  • Sandbox Environment: no sandbox
  • Model Version: gemini-2.5-pro
  • Memory Usage: 138.0 MB

Login information

API key

Anything else we need to know?

  • The failure reproduces consistently with any simple prompt.

  • Disabling only the Notion MCP (leaving other MCP servers intact) removes the error, suggesting the failure is triggered by this server’s FunctionDeclarations (likely exceeding the API’s nesting-depth constraints).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/toolsBuilt-in tools and the MCP ecosystem.kind/bugSomething isn't workingpriority/p1Important and should be addressed in the near term.sub-area/mcpIssues related to the Model Context Protocol (MCP).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions