@@ -20,7 +20,6 @@ import kotlinx.coroutines.flow.mapNotNull
2020import kotlinx.coroutines.flow.take
2121import kotlinx.coroutines.flow.toList
2222import kotlinx.io.IOException
23- import kotlinx.serialization.KSerializer
2423import kotlinx.serialization.SerialName
2524import kotlinx.serialization.Serializable
2625
@@ -31,14 +30,16 @@ import kotlinx.serialization.Serializable
3130 */
3231public class RegexSearchTool <Path >(
3332 private val fs : FileSystemProvider .ReadOnly <Path >,
34- ) : Tool<RegexSearchTool.Args, RegexSearchTool.Result>() {
35-
36- override val name: String = " __search_contents_by_regex__"
37- override val description: String = text {
33+ ) : Tool<RegexSearchTool.Args, RegexSearchTool.Result>(
34+ argsSerializer = Args .serializer(),
35+ resultSerializer = Result .serializer(),
36+ name = " __search_contents_by_regex__" ,
37+ description = text {
3838 +" Executes a regular expression search on folder or file contents within the specified path."
3939 +" The tool returns structured results with file paths, line numbers, positions, and excerpts where the text was found."
4040 +" The tool will solely return search results and does not modify any files."
4141 }
42+ ) {
4243
4344 /* *
4445 * Parameters for a regex content search.
@@ -73,9 +74,6 @@ public class RegexSearchTool<Path>(
7374 @Serializable
7475 public data class Result (val entries : List <FileSystemEntry .File >, val original : String )
7576
76- override val argsSerializer: KSerializer <Args > = Args .serializer()
77- override val resultSerializer: KSerializer <Result > = Result .serializer()
78-
7977 override suspend fun execute (args : Args ): Result {
8078 val path = fs.fromAbsolutePathString(args.path)
8179 val matches = search(path, args.regex, args.limit, args.skip, args.caseSensitive).toList()
0 commit comments