@@ -315,6 +315,36 @@ func TestUnrecognizedTools(t *testing.T) {
315315 withTools : []string {},
316316 expectedUnrecognized : nil ,
317317 },
318+ {
319+ name : "whitespace trimmed from valid tool" ,
320+ withTools : []string {" tool1 " , " tool2 " },
321+ expectedUnrecognized : nil ,
322+ },
323+ {
324+ name : "whitespace trimmed from invalid tool" ,
325+ withTools : []string {" invalid_tool " },
326+ expectedUnrecognized : []string {"invalid_tool" },
327+ },
328+ {
329+ name : "duplicate tools deduplicated" ,
330+ withTools : []string {"tool1" , "tool1" },
331+ expectedUnrecognized : nil ,
332+ },
333+ {
334+ name : "duplicate invalid tools deduplicated" ,
335+ withTools : []string {"blabla" , "blabla" },
336+ expectedUnrecognized : []string {"blabla" },
337+ },
338+ {
339+ name : "mixed whitespace and duplicates" ,
340+ withTools : []string {" tool1 " , "tool1" , " tool1 " },
341+ expectedUnrecognized : nil ,
342+ },
343+ {
344+ name : "empty strings ignored" ,
345+ withTools : []string {"" , "tool1" , " " , "" },
346+ expectedUnrecognized : nil ,
347+ },
318348 }
319349
320350 for _ , tt := range tests {
0 commit comments