Grok 4.5: 351 tools fail with HTTP 400 instead of reporting the 350-tool limit
まだ誰も着手していません。
- 主要言語
- Shell
- スター
- 11.2k
- フォーク
- 1.9k
- 平均マージ
- 14時間 16分
- マージ済み PR(30日)
- 6
説明
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
- Use a test MCP configuration with no other user/plugin MCP servers enabled, so they do not add to the count.
- Save
schema-repro.mjs,grok-350.json, andgrok-351.jsonfrom the Reproducer files section below in the same directory. Node.js must be available. - 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:
- Enforce a tool count budget before sending the request.
- 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.
- 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": ["*"]
}
}
}
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、grok-350.json と grok-351.json を使って 2 つのネイティブな Copilot コマンドを実行し、schema-repro.mjs を使って分離されたツール数を確認します。告知されたツール一覧を構築し、Grok のレスポンスを処理する CLI リクエスト経路を追跡します。350 個のツールは引き続き成功し、351 個では HTTP リクエストの前に対処可能な上限エラーが生成されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- node.js
- 領域
- api, cli
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 50/100