Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

test(cliproxyapi): update executor test for the broadened tool-name cloak

NomenAKdd6104ea3877
diff --git a/tests/unit/cliproxyapi-executor.test.ts b/tests/unit/cliproxyapi-executor.test.ts
index c5f1aab86c..3db932cfc1 100644
--- a/tests/unit/cliproxyapi-executor.test.ts
+++ b/tests/unit/cliproxyapi-executor.test.ts
@@ -457,14 +457,18 @@ describe("CliproxyapiExecutor", () => {
);
});
- it("does not rewrite non-mcp_ tool names", () => {
+ it("cloaks non-mcp third-party tool names to PascalCase (fingerprint defense, PR #2943)", () => {
const exec = new CliproxyapiExecutor();
const body = anthropicBodyWithTools([
{ name: "my_tool", description: "My tool", input_schema: {} },
]);
const result = exec.transformRequest("claude-opus-4-7", body, true, {});
const toolName = (result.tools as Array<{ name: string }>)[0].name;
- assert.equal(toolName, "my_tool");
+ // Non-Claude-Code tool names are now cloaked (my_tool -> MyTool) so Anthropic
+ // does not fingerprint the third-party harness; restored on the response via
+ // the non-enumerable _toolNameMap.
+ assert.equal(toolName, "MyTool");
+ assert.equal((result._toolNameMap as Map<string, string>).get("MyTool"), "my_tool");
});
it("rewrites mcp_* tool_use names in assistant message history", () => {