Skip to content

Commit eb7fea9

Browse files
author
Zoo (VP)
committed
test(mcp): pin unsupported mixed-separator tool name behavior
1 parent ce56786 commit eb7fea9

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎src/utils/__tests__/mcp-name.spec.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ describe("mcp-name utilities", () => {
257257
expect(parseMcpToolName("mcp--")).toBeNull()
258258
expect(parseMcpToolName("mcp--server")).toBeNull()
259259
})
260+
261+
it("should return null for names with mixed separators", () => {
262+
// normalizeMcpToolName picks a single separator for the whole split,
263+
// so mixed-separator names are left unnormalized and cannot be parsed
264+
expect(parseMcpToolName("mcp__server--tool")).toBeNull()
265+
expect(parseMcpToolName("mcp--server__tool")).toBeNull()
266+
})
260267
})
261268

262269
describe("normalizeMcpToolName", () => {
@@ -289,6 +296,13 @@ describe("mcp-name utilities", () => {
289296
it("should preserve double underscores in server names", () => {
290297
expect(normalizeMcpToolName("mcp--my__server--do_thing")).toBe("mcp--my__server--do_thing")
291298
})
299+
300+
it("should return names with mixed separators unchanged (unsupported)", () => {
301+
// A single separator style is chosen for the entire split, so names
302+
// mixing "--" and "__" separators cannot be normalized
303+
expect(normalizeMcpToolName("mcp__server--tool")).toBe("mcp__server--tool")
304+
expect(normalizeMcpToolName("mcp--server__tool")).toBe("mcp--server__tool")
305+
})
292306
})
293307

294308
describe("roundtrip behavior", () => {

0 commit comments

Comments
 (0)