Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Grok 4.5: 351 tools fail with HTTP 400 instead of reporting the 350-tool limit

未關閉
#4,836 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
50/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
node.js
領域
api, cli

研究方向

首先使用 grok-350.json 和 grok-351.json 執行兩個原生 Copilot 命令,並使用 schema-repro.mjs 確認隔離的工具數量。追蹤建立所宣告工具清單並處理 Grok 回應的 CLI 請求路徑;完成的標準是 350 個工具仍然成功,而 351 個工具會在 HTTP 請求之前產生可採取行動的限制錯誤。

由索引模型根據 Issue 內容生成。

描述

triage

Type: Bug

Copilot CLI Version: 1.0.84-5
OS Version: Windows 11 x64
Model: grok-4.5

Summary

When the total number of advertised tools exceeds 350, requests to grok-4.5 fail with HTTP 400 Bad Request.

Copilot CLI does not enforce or report the tool count limit before making the API call.

Steps to Reproduce
  1. Use a test MCP configuration with no other user/plugin MCP servers enabled, so they do not add to the count.
  2. Save schema-repro.mjs, grok-350.json, and grok-351.json from the Reproducer files section below in the same directory. Node.js must be available.
  3. From that directory, run these native Copilot commands:
copilot --model grok-4.5 --no-custom-instructions --disable-builtin-mcps --disable-mcp-server computer-use --additional-mcp-config "@grok-350.json" --available-tools "mcp:*" --allow-all-tools -p "Reply with exactly OK. Do not call tools."
copilot --model grok-4.5 --no-custom-instructions --disable-builtin-mcps --disable-mcp-server computer-use --additional-mcp-config "@grok-351.json" --available-tools "mcp:*" --allow-all-tools -p "Reply with exactly OK. Do not call tools."

The fixture tools have unique names and identical simple schemas. mcp:* excludes native CLI tools; the MCP-only precondition isolates the fixture's 350/351 count. There is no SDK dependency or shell helper.

Actual Behaviour

With 350 tools:

  • Request succeeds with exit code 0.

With 351 tools:

  • Request immediately fails with:
Execution failed: 400 Bad Request (Request ID: ...)

Comparison:

Tool Count Model Result
350 tools grok-4.5 OK (exit 0)
351 tools grok-4.5 HTTP 400 (exit 1)

The debug tool-surface records confirm exactly 350 and 351 advertised tools for these two runs.

Expected Behaviour

Copilot CLI should track provider-specific limits:

  1. Enforce a tool count budget before sending the request.
  2. If tool count exceeds 350 for Grok, report an actionable error explaining that the active tool count (351) exceeds Grok's maximum limit of 350 tools.
  3. Alternatively, defer tools via tool search rather than sending the entire catalog upfront.
Notes
  • Tested with inert synthetic tools with identical simple schemas ({"type":"object","properties":{"value":{"type":"string"}}}).
  • The issue is purely triggered by the total number of advertised tools, regardless of whether tools are actually invoked by the model.
Impact

Users with multiple MCP servers easily exceed 350 tools in aggregate (native + MCP tools), causing Grok to become completely unusable across the entire session with an unhelpful 400 error.

Reproducer files
schema-repro.mjs
import { createInterface } from 'node:readline';

const mode = process.argv[2];
const count = Number(process.argv[3] ?? 1);
const allowedModes = ['array-enum-bad', 'array-enum-fixed', 'count'];

if (!allowedModes.includes(mode) ||
    !Number.isInteger(count) ||
    count < 1 ||
    count > 400) {
  throw new Error('Usage: node schema-repro.mjs array-enum-bad|array-enum-fixed|count [1..400]');
}

const levels = { type: ['array', 'null'], items: { type: 'integer' } };
if (mode === 'array-enum-bad') {
  levels.enum = [0, 1, 2, 3, 4, 25];
} else {
  levels.items.enum = [0, 1, 2, 3, 4, 25];
}

const tools = Array.from({ length: mode === 'count' ? count : 1 }, (_, index) => ({
  name: `probe_${String(index).padStart(3, '0')}`,
  description: 'Schema diagnostic only; performs no operation.',
  inputSchema: {
    type: 'object',
    properties: mode === 'count' ? { value: { type: 'string' } } : { levels },
  },
}));

for await (const line of createInterface({ input: process.stdin, crlfDelay: Infinity })) {
  if (!line.trim()) {
    continue;
  }
  const request = JSON.parse(line);
  if (request.id === undefined) {
    continue;
  }

  let result;
  if (request.method === 'initialize') {
    result = {
      protocolVersion: request.params.protocolVersion,
      capabilities: { tools: {} },
      serverInfo: { name: 'schema-repro', version: '1.0.0' },
    };
  } else if (request.method === 'tools/list') {
    result = { tools };
  } else if (request.method === 'tools/call') {
    result = {
      isError: true,
      content: [{ type: 'text', text: 'This diagnostic never executes an operation.' }],
    };
  } else if (request.method === 'ping') {
    result = {};
  } else {
    process.stdout.write(`${JSON.stringify({
      jsonrpc: '2.0',
      id: request.id,
      error: { code: -32601, message: 'Method not found' },
    })}\n`);
    continue;
  }

  process.stdout.write(`${JSON.stringify({ jsonrpc: '2.0', id: request.id, result })}\n`);
}
grok-350.json
{
  "mcpServers": {
    "schema_repro": {
      "type": "stdio",
      "command": "node",
      "args": ["schema-repro.mjs", "count", "350"],
      "tools": ["*"]
    }
  }
}
grok-351.json
{
  "mcpServers": {
    "schema_repro": {
      "type": "stdio",
      "command": "node",
      "args": ["schema-repro.mjs", "count", "351"],
      "tools": ["*"]
    }
  }
}
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
17 小時 6 分鐘
30 天內合併 PR
5

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/copilot-cli 的其他 Issue

查看 github/copilot-cli 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。