Skip to content

[Bug Report]: 阿里百炼无法正确处理 Gemini CLI Tool Calls 结果 #161

Description

@Dragon1573

Important

此处为 Nyro 新用户,暂未找到 Nyro 的详细官方文档。

问题概述

不确定是不是 Nyro 对 Agent Clients 和 Model Providers 之间的协议转换是单向的,个人感觉像是 qwen3.6-plus 根据提示词分析出需要调用 GitHub MCP 中的 Tools ,但在响应中生成了与 Gemini CLI 格式不匹配的工具调用方法,此处 Nyro 没有做反向转换。

前置环境

客户端 Gemini CLI v0.42.0
npm install -g @google/gemini-cli
中转层 Nyro Desktop v1.7.3
模型厂商 阿里百炼(按量计费,新用户免费额度模式)
选用模型 qwen3.6-plus
服务端协议 (优先)Anthropic Messages
OpenAI Compatible
OpenAI Responses

Nyro Desktop 详细配置与日志截图

图有点长,此处折叠

Image Image Image Image Image

Gemini CLI 调试日志(节选)

太长了

23:14:11 D:\...\clash-verge-rev  [dev ≡] 0ms pwsh
$ gemini -d -p "尝试使用 GitHub MCP 查询 Issue clash-verge-rev/clash-verge-rev#7017 ,分析此 Issue 的需求"
Ignore file not found: D:\Repository\clash-verge-rev\.geminiignore, continue without it.
Experiments loaded {
  experimentIds: [],
  flags: []
}
Current heap size 16368.00 MB
Ignore file not found: D:\Repository\clash-verge-rev\.geminiignore, continue without it.
Experiments loaded {
  experimentIds: [],
  flags: []
}
[AgentRegistry] User policy exists for 'codebase_investigator', skipping dynamic registration.
[AgentRegistry] User policy exists for 'cli_help', skipping dynamic registration.
[AgentRegistry] Loaded with 3 agents.
Ignore file not found: D:\Repository\clash-verge-rev\.geminiignore, continue without it.
Ripgrep is not available. Falling back to GrepTool.
Flushing log events to Clearcut.
ClearcutLogger: Flush already in progress, marking pending flush.
ClearcutLogger: Flush already in progress, marking pending flush.
Registering notification handlers for server 'playwright'. Capabilities: { tools: {} }
Server 'playwright' has tools but did not declare 'listChanged' capability. Listening anyway for robustness...
Flushing log events to Clearcut.
Registering notification handlers for server 'github'. Capabilities: { completions: {}, prompts: {}, resources: {}, tools: {} }
Server 'github' has tools but did not declare 'listChanged' capability. Listening anyway for robustness...
Server 'github' has resources but did not declare 'listChanged' capability. Listening anyway for robustness...
Server 'github' has prompts but did not declare 'listChanged' capability. Listening anyway for robustness...
Error flushing log events: HTTP 400:
ClearcutLogger: Re-queued 2 events for retry (queue size: 2)
Scheduling MCP context refresh...
Executing MCP context refresh...
[DEBUG] [MemoryDiscovery] Loading server hierarchical memory for CWD: D:\Repository\clash-verge-rev (importFormat: tree)
[DEBUG] [MemoryDiscovery] Found readable global AGENTS.md: c:/users/dragon1573/.gemini/agents.md
[DEBUG] [MemoryDiscovery] Searching for AGENTS.md starting from CWD: d:/repository/clash-verge-rev
[DEBUG] [MemoryDiscovery] Determined project root: d:/repository/clash-verge-rev
[DEBUG] [MemoryDiscovery] Searching for CONTEXT.md starting from CWD: d:/repository/clash-verge-rev
[DEBUG] [MemoryDiscovery] Determined project root: d:/repository/clash-verge-rev
[DEBUG] [MemoryDiscovery] Searching for GEMINI.md starting from CWD: d:/repository/clash-verge-rev
[DEBUG] [MemoryDiscovery] Determined project root: d:/repository/clash-verge-rev
[DEBUG] [MemoryDiscovery] Searching for README.md starting from CWD: d:/repository/clash-verge-rev
[DEBUG] [MemoryDiscovery] Determined project root: d:/repository/clash-verge-rev
[DEBUG] [MemoryDiscovery] deduplication: keeping c:/users/dragon1573/.gemini/agents.md (dev: 2020978696, ino: 39969446693121660)
[DEBUG] [MemoryDiscovery] deduplication: keeping d:/repository/clash-verge-rev/agents.md (dev: 2765942855, ino: 5764607524627372000)
[DEBUG] [MemoryDiscovery] deduplication: keeping d:/repository/clash-verge-rev/readme.md (dev: 2765942855, ino: 5764607524594866000)
[DEBUG] [MemoryDiscovery] deduplication: keeping d:/repository/clash-verge-rev/.agents/skills/tauri-v2/readme.md (dev: 2765942855, ino: 6917529027675736000)
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: d:/repository/clash-verge-rev/agents.md (Length: 3498)
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: d:/repository/clash-verge-rev/readme.md (Length: 4589)
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: d:/repository/clash-verge-rev/.agents/skills/tauri-v2/readme.md (Length: 7586)
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: c:/users/dragon1573/.gemini/agents.md (Length: 1574)
MCP context refresh complete.
Hook registry initialized with 0 hook entries
Hook system initialized successfully
[DEBUG] [MemoryDiscovery] Found global memory file: c:/users/dragon1573/.gemini/agents.md
[DEBUG] [MemoryDiscovery] Loading environment memory for trusted root: d:/repository/clash-verge-rev (Stopping at git root: d:/repository/clash-verge-rev)
[DEBUG] [MemoryDiscovery] Starting upward search from d:/repository/clash-verge-rev stopping at d:/repository/clash-verge-rev
[DEBUG] [MemoryDiscovery] deduplication: keeping c:/users/dragon1573/.gemini/agents.md (dev: 2020978696, ino: 39969446693121660)
[DEBUG] [MemoryDiscovery] deduplication: keeping d:/repository/clash-verge-rev/agents.md (dev: 2765942855, ino: 5764607524627372000)
[DEBUG] [MemoryDiscovery] deduplication: keeping d:/repository/clash-verge-rev/readme.md (dev: 2765942855, ino: 5764607524594866000)
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: d:/repository/clash-verge-rev/readme.md (Length: 4589)
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: d:/repository/clash-verge-rev/agents.md (Length: 3498)
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: c:/users/dragon1573/.gemini/agents.md (Length: 1574)
[STARTUP] StartupProfiler.flush() called with 9 phases
[STARTUP] Recording metric for phase: cli_startup duration: 403.7063
[STARTUP] Recording metric for phase: load_settings duration: 6.222100000000012
[STARTUP] Recording metric for phase: cleanup_ops duration: 156.76930000000004
[STARTUP] Recording metric for phase: parse_arguments duration: 19.149900000000002
[STARTUP] Recording metric for phase: load_cli_config duration: 109.58190000000002
[STARTUP] Recording metric for phase: setup_terminal duration: 0.244199999999978
[STARTUP] Recording metric for phase: initialize_app duration: 8.28690000000006
[STARTUP] Recording metric for phase: authenticate duration: 0.3854999999999791
[STARTUP] Recording metric for phase: discover_tools duration: 29.33299999999997
Experiments loaded {
  experimentIds: [],
  flags: []
}
Session ID: 3bb8517c-04d5-4283-b318-d412eadacc11
[Routing] Selected model: gemini-3-flash-preview (Source: agent-router/override, Latency: 0ms)
        [Routing] Reasoning: Routing bypassed by forced model directive. Using: gemini-3-flash-preview
用户要求分析 GitHub Issue #7017,我需要先通过 Google 搜索获取该 Issue 的具体内容和需求信息。
[MESSAGE_BUS] publish: {"type":"tool-calls-update","toolCalls":[{"status":"validating","request":{"callId":"google_web_search_1779117268956_0","name":"google_web_search","args":{"query":"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017"},"isClientInitiated":false,"prompt_id":"3bb8517c-04d5-4283-b318-d412eadacc11","schedulerId":"root"},"tool":{"name":"google_web_search","displayName":"GoogleSearch","description":"Performs a web search using Google Search (via the Gemini API) and returns the results. This tool is useful for finding information on the internet based on a query.","kind":"search","parameterSchema":{"type":"object","properties":{"query":{"type":"string","description":"The search query to find information on the web."}},"required":["query"]}},"invocation":{"params":"[Circular]"},"startTime":1779117268979,"schedulerId":"root","approvalMode":"default"}],"schedulerId":"root"}
[MESSAGE_BUS] publish: {"type":"tool-calls-update","toolCalls":[{"status":"validating","request":{"callId":"google_web_search_1779117268956_0","name":"google_web_search","args":{"query":"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017"},"isClientInitiated":false,"prompt_id":"3bb8517c-04d5-4283-b318-d412eadacc11","schedulerId":"root"},"tool":{"name":"google_web_search","displayName":"GoogleSearch","description":"Performs a web search using Google Search (via the Gemini API) and returns the results. This tool is useful for finding information on the internet based on a query.","kind":"search","parameterSchema":{"type":"object","properties":{"query":{"type":"string","description":"The search query to find information on the web."}},"required":["query"]}},"invocation":{"params":"[Circular]"},"startTime":1779117268979,"schedulerId":"root","approvalMode":"default"}],"schedulerId":"root"}
[PolicyEngine.check] toolCall.name: google_web_search, stringifiedArgs: {"query":"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017"}
[PolicyEngine.check] MATCHED rule: toolName=google_web_search, decision=allow, priority=1.05, argsPattern=none
[PolicyEngine.check] Running safety checker: conseca
[ContextBuilder] buildFullContext called. Converted history length: 2
[Conseca] check called. History is: ......(这里有很长一大串 System Prompt)
[Conseca] check failed: Config not initialized
[MESSAGE_BUS] publish: {"type":"tool-calls-update","toolCalls":[{"status":"validating","request":{"callId":"google_web_search_1779117268956_0","name":"google_web_search","args":{"query":"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017"},"isClientInitiated":false,"prompt_id":"3bb8517c-04d5-4283-b318-d412eadacc11","schedulerId":"root"},"tool":{"name":"google_web_search","displayName":"GoogleSearch","description":"Performs a web search using Google Search (via the Gemini API) and returns the results. This tool is useful for finding information on the internet based on a query.","kind":"search","parameterSchema":{"type":"object","properties":{"query":{"type":"string","description":"The search query to find information on the web."}},"required":["query"]}},"invocation":{"params":"[Circular]"},"startTime":1779117268979,"schedulerId":"root","approvalMode":"default","outcome":"proceed_once"}],"schedulerId":"root"}
[MESSAGE_BUS] publish: {"type":"tool-calls-update","toolCalls":[{"request":{"callId":"google_web_search_1779117268956_0","name":"google_web_search","args":{"query":"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017"},"isClientInitiated":false,"prompt_id":"3bb8517c-04d5-4283-b318-d412eadacc11","schedulerId":"root"},"tool":{"name":"google_web_search","displayName":"GoogleSearch","description":"Performs a web search using Google Search (via the Gemini API) and returns the results. This tool is useful for finding information on the internet based on a query.","kind":"search","parameterSchema":{"type":"object","properties":{"query":{"type":"string","description":"The search query to find information on the web."}},"required":["query"]}},"status":"scheduled","startTime":1779117268979,"outcome":"proceed_once","invocation":{"params":"[Circular]"},"schedulerId":"root","approvalMode":"default"}],"schedulerId":"root"}
[MESSAGE_BUS] publish: {"type":"tool-calls-update","toolCalls":[{"request":{"callId":"google_web_search_1779117268956_0","name":"google_web_search","args":{"query":"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017"},"isClientInitiated":false,"prompt_id":"3bb8517c-04d5-4283-b318-d412eadacc11","schedulerId":"root"},"tool":{"name":"google_web_search","displayName":"GoogleSearch","description":"Performs a web search using Google Search (via the Gemini API) and returns the results. This tool is useful for finding information on the internet based on a query.","kind":"search","parameterSchema":{"type":"object","properties":{"query":{"type":"string","description":"The search query to find information on the web."}},"required":["query"]}},"status":"executing","startTime":1779117268979,"outcome":"proceed_once","invocation":{"params":"[Circular]"},"schedulerId":"root","approvalMode":"default"}],"schedulerId":"root"}
[MESSAGE_BUS] publish: {"type":"tool-calls-update","toolCalls":[{"request":{"callId":"google_web_search_1779117268956_0","name":"google_web_search","args":{"query":"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017"},"isClientInitiated":false,"prompt_id":"3bb8517c-04d5-4283-b318-d412eadacc11","schedulerId":"root"},"tool":{"name":"google_web_search","displayName":"GoogleSearch","description":"Performs a web search using Google Search (via the Gemini API) and returns the results. This tool is useful for finding information on the internet based on a query.","kind":"search","parameterSchema":{"type":"object","properties":{"query":{"type":"string","description":"The search query to find information on the web."}},"required":["query"]}},"invocation":{"params":"[Circular]"},"status":"success","response":{"callId":"google_web_search_1779117268956_0","responseParts":[{"functionResponse":{"id":"google_web_search_1779117268956_0","name":"google_web_search","response":{"output":"No search results or information found for query: \"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017\""}}}],"resultDisplay":"No information found.","contentLength":111},"durationMs":125,"outcome":"proceed_once","schedulerId":"root","approvalMode":"default"}],"schedulerId":"root"}
[MESSAGE_BUS] publish: {"type":"tool-calls-update","toolCalls":[{"request":{"callId":"google_web_search_1779117268956_0","name":"google_web_search","args":{"query":"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017"},"isClientInitiated":false,"prompt_id":"3bb8517c-04d5-4283-b318-d412eadacc11","schedulerId":"root"},"tool":{"name":"google_web_search","displayName":"GoogleSearch","description":"Performs a web search using Google Search (via the Gemini API) and returns the results. This tool is useful for finding information on the internet based on a query.","kind":"search","parameterSchema":{"type":"object","properties":{"query":{"type":"string","description":"The search query to find information on the web."}},"required":["query"]}},"invocation":{"params":"[Circular]"},"status":"success","response":{"callId":"google_web_search_1779117268956_0","responseParts":[{"functionResponse":{"id":"google_web_search_1779117268956_0","name":"google_web_search","response":{"output":"No search results or information found for query: \"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017\""}}}],"resultDisplay":"No information found.","contentLength":111},"durationMs":125,"outcome":"proceed_once","schedulerId":"root","approvalMode":"default"}],"schedulerId":"root"}
[MESSAGE_BUS] publish: {"type":"tool-calls-update","toolCalls":[],"schedulerId":"root"}
Error when talking to Gemini API Full report available at: C:\Users\DRAGON~1\AppData\Local\Temp\gemini-client-error-Turn.run-sendMessageStream-2026-05-18T15-14-29-178Z.json _ApiError: {"error":{"code":"invalid_value","message":"Invalid value: function. Supported values are: 'text','image_url','video_url' and 'video'.","param":"'messages.[0].content[1].type'","type":"invalid_request_error"},"request_id":"chatcmpl-a7dc05cb-8bc9-9385-a9e3-e101df02592e"}
    at throwErrorIfNotOK (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-JEW7ZIWE.js:36185:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-JEW7ZIWE.js:35948:7
    at async Models.generateContentStream (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-JEW7ZIWE.js:37044:16)
    at async file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:273597:19
    at async file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:250407:23
    at async retryWithBackoff (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:270684:23)
    at async GeminiChat.makeApiCallAndProcessStream (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:293631:28)
    at async GeminiChat.streamWithRetries (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:293450:29)
    at async Turn.run (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:294024:24) {
  status: 400
}
An unexpected critical error occurred:[object Object]

报错最后导出的 Context JSON

也挺长的

{
  "error": {
    "message": "{\"error\":{\"code\":\"invalid_value\",\"message\":\"Invalid value: function. Supported values are: 'text','image_url','video_url' and 'video'.\",\"param\":\"'messages.[0].content[1].type'\",\"type\":\"invalid_request_error\"},\"request_id\":\"chatcmpl-a7dc05cb-8bc9-9385-a9e3-e101df02592e\"}",
    "stack": "ApiError: {\"error\":{\"code\":\"invalid_value\",\"message\":\"Invalid value: function. Supported values are: 'text','image_url','video_url' and 'video'.\",\"param\":\"'messages.[0].content[1].type'\",\"type\":\"invalid_request_error\"},\"request_id\":\"chatcmpl-a7dc05cb-8bc9-9385-a9e3-e101df02592e\"}\n    at throwErrorIfNotOK (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-JEW7ZIWE.js:36185:24)\n    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n    at async file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-JEW7ZIWE.js:35948:7\n    at async Models.generateContentStream (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-JEW7ZIWE.js:37044:16)\n    at async file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:273597:19\n    at async file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:250407:23\n    at async retryWithBackoff (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:270684:23)\n    at async GeminiChat.makeApiCallAndProcessStream (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:293631:28)\n    at async GeminiChat.streamWithRetries (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:293450:29)\n    at async Turn.run (file:///D:/PackageCache/npm/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:294024:24)"
  },
  "context": [
    {
      "role": "user",
      "parts": [
        {
          "text": "(系统提示词超过 4KiB ,此处省略)"
        }
      ]
    },
    {
      "role": "user",
      "parts": [
        {
          "text": "尝试使用 GitHub MCP 查询 Issue clash-verge-rev/clash-verge-rev#7017 ,分析此 Issue 的需求"
        }
      ]
    },
    {
      "role": "model",
      "parts": [
        {
          "text": "用户要求分析 GitHub Issue #7017,我需要先通过 Google 搜索获取该 Issue 的具体内容和需求信息。\n"
        },
        {
          "functionCall": {
            "args": {
              "query": "site:github.com/clash-verge-rev/clash-verge-rev/issues/7017"
            },
            "name": "google_web_search"
          }
        }
      ]
    },
    {
      "role": "user",
      "parts": [
        {
          "functionResponse": {
            "id": "google_web_search_1779117268956_0",
            "name": "google_web_search",
            "response": {
              "output": "No search results or information found for query: \"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017\""
            }
          }
        }
      ]
    },
    {
      "role": "user",
      "parts": [
        {
          "functionResponse": {
            "id": "google_web_search_1779117268956_0",
            "name": "google_web_search",
            "response": {
              "output": "No search results or information found for query: \"site:github.com/clash-verge-rev/clash-verge-rev/issues/7017\""
            }
          }
        }
      ]
    }
  ]
}

Gemini CLI 自身配置

有点复杂,敏感信息已通过 Gemini CLI 的环境变量注入实现脱敏

{
  "agents": {
    "overrides": {
      "cli_help": {
        "enabled": true,
        "modelConfig": {
          "model": "inherit"
        }
      }
    }
  },
  "context": {
    "fileName": [
      "AGENTS.md",
      "CONTEXT.md",
      "GEMINI.md",
      "README.md"
    ]
  },
  "general": {
    "preferredEditor": "neovim",
    "vimMode": false
  },
  "ide": {
    "enabled": true,
    "hasSeenNudge": true
  },
  "mcpServers": {
    "github": {
      "headers": {
        "Authorization": "Bearer $WINGET_PKGS_GITHUB_TOKEN"
      },
      "httpUrl": "https://api.githubcopilot.com/mcp/insiders",
      "timeout": 60000
    },
    "playwright": {
      "args": [
        "@playwright/mcp@latest"
      ],
      "command": "npx",
      "env": {
        "PLAYWRIGHT_MCP_EXTENSION_TOKEN": "$PLAYWRIGHT_MCP_EXTENSION_TOKEN"
      },
      "timeout": 60000
    }
  },
  "model": {
    "name": "auto-gemini-3"  // 这个手动改了很多次都改不掉
  },
  "security": {
    "auth": {
      "selectedType": "gemini-api-key"
    }
  },
  "ui": {
    "footer": {
      "items": [
        "workspace",
        "git-branch",
        "sandbox",
        "model-name",
        "quota",
        "context-used",
        "memory-usage",
        "token-count"
      ],
      "showLabels": true
    }
  }
}

Originally posted by @Dragon1573 in #131

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions