Skip to content

Commit cde8bf4

Browse files
committed
fix(BuiltinMcpTools): replace toLowerCase() with lowercase() for string comparison
1 parent 90555d6 commit cde8bf4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

core/src/main/kotlin/cc/unitmesh/devti/mcp/host/BuiltinMcpTools.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ class FindFilesByNameSubstring : AbstractMcpTool<Query>() {
304304
val projectDir = project.guessProjectDir()?.toNioPathOrNull()
305305
?: return Response(error = "project dir not found")
306306

307-
val searchSubstring = args.nameSubstring.toLowerCase()
307+
val searchSubstring = args.nameSubstring.lowercase()
308308
return runReadAction {
309309
Response(
310310
FilenameIndex.getAllFilenames(project)
311-
.filter { it.toLowerCase().contains(searchSubstring) }
311+
.filter { it.lowercase().contains(searchSubstring) }
312312
.flatMap {
313313
FilenameIndex.getVirtualFilesByName(it, GlobalSearchScope.projectScope(project))
314314
}
@@ -319,12 +319,10 @@ class FindFilesByNameSubstring : AbstractMcpTool<Query>() {
319319
} catch (e: IllegalArgumentException) {
320320
false
321321
}
322-
}
323-
.map { file ->
322+
}.joinToString(",\n", prefix = "[", postfix = "]") { file ->
324323
val relativePath = projectDir.relativize(Path(file.path)).toString()
325324
"""{"path": "$relativePath", "name": "${file.name}"}"""
326325
}
327-
.joinToString(",\n", prefix = "[", postfix = "]")
328326
)
329327
}
330328
}

0 commit comments

Comments
 (0)