Fix: Gemini CLI 400 Bad Request With 128+ Tools
Originally published on DebugRadar . Gemini CLI returns an HTTP 400 error when too many tools are enabled — the request trips the Gemini API tool limit and fails. The practical fix is to trim your enabled tools: disable the MCP servers and extensions you do not need for the task, then retry. A fix is in progress (pull request #26084 caps the tool count automatically), but it is still open and not…
When using the Gemini CLI with more than 128 enabled tools, it returns an HTTP 400 error because the request exceeds the Gemini API's tool limit. This issue affects the CLI (google-gemini/gemini-cli) and is currently open in the GitHub issue #24246. The exact tool limit threshold is unclear, but treating 128 as the safe ceiling is recommended until further confirmation.
To resolve the error, users should disable unnecessary MCP servers and extensions in the CLI settings and retry the prompt. Pull request #26084, titled "Fix 400 error when 128 tools enabled," aims to automatically cap the tool count at the API limit, but it is still open and not merged. Until the fix is merged, users must manually trim their enabled tools to avoid triggering the 400 error.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to