When using the Gemini LLM provider, tools that return an error
(isError: true) enter an infinite retry loop instead of returning a
response to the user. The request must be manually cancelled. The same
tools work correctly with the Anthropic provider.
Configuration
llm:
enabled: true
provider: gemini
model: gemini-2.5-flash
gemini_api_key_file: "/tmp/.gemini-api-key"
per_attempt_timeout: 60
Tools Tested
| Tool |
Result |
| list_database_connections |
Pass |
| get_schema_info |
Pass |
| read_resource |
Infinite loop |
| count_rows |
Infinite loop |
| query_database |
Infinite loop |
Steps to Reproduce
- Configure the server with provider: gemini, model: gemini-2.5-flash
- Open the web client and authenticate
- Ask: "Read the system info resource"
→ read_resource loops indefinitely
- Ask: "How many rows are in the docs table?"
→ count_rows loops indefinitely
- Ask: "Query the primary database: SELECT version()"
→ query_database loops indefinitely
Actual Result
Tools enter an infinite retry loop (40+ calls observed) until the
user manually cancels. Example:
read_resource ❌ → read_resource ❌ → read_resource ❌ → ...
Expected Result
All tools return a result and the LLM responds to the user .
Possible Root Cause
The pgedge-go-llm-lib proxy converts MCP tool results into Gemini's
functionResponse format. When a tool returns isError: true, the proxy
likely passes it without Gemini-specific error formatting. Gemini does
not recognize isError: true as a terminal failure and treats it as an
unresolved function call to retry. Anthropic natively understands
isError: true as part of the MCP spec.
Gemini expects errors formatted as:
{
"functionResponse": {
"name": "tool_name",
"response": {
"error": "error message here"
}
}
}
When using the Gemini LLM provider, tools that return an error
(isError: true) enter an infinite retry loop instead of returning a
response to the user. The request must be manually cancelled. The same
tools work correctly with the Anthropic provider.
Configuration
Tools Tested
Steps to Reproduce
→ read_resource loops indefinitely
→ count_rows loops indefinitely
→ query_database loops indefinitely
Actual Result
Tools enter an infinite retry loop (40+ calls observed) until the
user manually cancels. Example:
read_resource ❌ → read_resource ❌ → read_resource ❌ → ...
Expected Result
All tools return a result and the LLM responds to the user .
Possible Root Cause
The pgedge-go-llm-lib proxy converts MCP tool results into Gemini's
functionResponse format. When a tool returns isError: true, the proxy
likely passes it without Gemini-specific error formatting. Gemini does
not recognize isError: true as a terminal failure and treats it as an
unresolved function call to retry. Anthropic natively understands
isError: true as part of the MCP spec.
Gemini expects errors formatted as:
{
"functionResponse": {
"name": "tool_name",
"response": {
"error": "error message here"
}
}
}