You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Free-tier 429s on client tool descriptions (DeepSeek Harness), not on names or schemas #188
On 1.5.0 (with #182 / the mcp_ namespace), free-tier requests still answer 429 FreeUsageLimitError when a client tool description carries another client's wording. Tool names and schemas are not the trigger.
Reproduction
Client: DeepSeek Harness, "Standart" preset — 110 client tools, 6 messages, ~139 KB shaped body, deepseek-v4.1-flash-free. The exact captured body replayed through the gateway answers 429 every time; the "PTC" preset (one run_code tool, comparable body size) answers 200.
Bisecting only the tool list of that same body:
variant
result
110 client tools as sent
429
minus edit, read, skill, glob, grep, subagent, write
200
plus client glob / grep / subagent / write (one at a time)
200
plus client edit / read / skill (one at a time)
429
the same tools renamed (edit_alt, …)
429
the same tools with the description replaced by neutral text
200
an unrelated tool carrying the flagged description
429
The gate is the top-level description string, matched case-insensitively as a substring:
Read a UTF-8 text file and return line-numbered content. → 429 (trailing period optional)
Read a UTF-8 text file and return content. → 200
Read a text file and return line-numbered content. → 200
Tool. Read a UTF-8 text file and return line-numbered content. → 429 (substring match, prefixing does not help)
the same sentence inside a parameter description → 200
Same for Edit an existing UTF-8 text file by replacing literal text. and the DSH skill description; the skill fragment starts mid-description, so changing only the first word is not enough.
Local fix
renameAndCompleteTools re-spaces each client tool description before it reaches the wire (every space becomes two spaces). The decoded text reads the same but no longer matches the blocked substring; parameter descriptions and the official definitions are left untouched. Unit test added; go vet and go test ./internal/... pass.
Verified live: the exact Standart body now answers 200, PTC stays 200.
No credentials or private prompt content are included.
Free-model shaping now replaces ordinary ASCII spaces with U+00A0 NBSP in client tools' top-level descriptions by default. This covers Chat, Responses, Anthropic and the legacy functions path. Parameter descriptions, schemas, appended official tools and tool-name restoration are unchanged by this conversion. Existing NBSP is preserved, so the space conversion does not accumulate on repeated application.
Validation used the supplied 38-tool, 7-message DSH request containing the reported read/edit descriptions; this is a different capture from the issue's original 110-tool request. With the same session/project identity, original descriptions returned 429, NBSP returned 200 with a completed assistant response, and restoring the original descriptions returned 429 again. After enabling the production default, the unmodified request also returned 200 and completed in one upstream attempt. No model tool calls were executed.
Windows build, go vet, 36 tool integration checks and 167 environment regression checks passed. The tool checks cover all three protocols, legacy functions, schema/official-tool preservation, request references and streamed/non-streamed tool-name restoration.
This addresses the current matching behavior; future upstream normalization could change the result. Spaces inside code examples or exact string literals within top-level descriptions are also replaced. Genuine quota/rate-limit 429 handling remains unchanged.
Activity
fix(gateway): use NBSP in client tool descriptions (#188)
jasonxu114514 commentedon Nov 20, 2026
Fixed on main in 6575c62: 6575c62 .
Free-model shaping now replaces ordinary ASCII spaces with U+00A0 NBSP in client tools' top-level descriptions by default. This covers Chat, Responses, Anthropic and the legacy functions path. Parameter descriptions, schemas, appended official tools and tool-name restoration are unchanged by this conversion. Existing NBSP is preserved, so the space conversion does not accumulate on repeated application.
Validation used the supplied 38-tool, 7-message DSH request containing the reported read/edit descriptions; this is a different capture from the issue's original 110-tool request. With the same session/project identity, original descriptions returned 429, NBSP returned 200 with a completed assistant response, and restoring the original descriptions returned 429 again. After enabling the production default, the unmodified request also returned 200 and completed in one upstream attempt. No model tool calls were executed.
Windows build, go vet, 36 tool integration checks and 167 environment regression checks passed. The tool checks cover all three protocols, legacy functions, schema/official-tool preservation, request references and streamed/non-streamed tool-name restoration.
This addresses the current matching behavior; future upstream normalization could change the result. Spaces inside code examples or exact string literals within top-level descriptions are also replaced. Genuine quota/rate-limit 429 handling remains unchanged.
The fix is pushed to main. Closing as completed.