FileReaderTool

@Component
class FileReaderTool @Autowired constructor(properties: AgentConstraintsProperties)

Constructors

Link copied to clipboard
@Autowired
constructor(properties: AgentConstraintsProperties)

Functions

Link copied to clipboard
@Tool(description = "List directory contents.")
fun listDirectories(@McpToolParam(description = "The relative path of the directory to list") relativePath: String = ".", @McpToolParam(description = "Whether to list contents recursively") recursive: Boolean = false): DirectoryListingResponse
Link copied to clipboard
@Tool(description = "Read a UTF-8 text file within the project directory. Supports line-based reading and safety limits.")
fun readFile(@McpToolParam(description = "The relative path to the file from the project root") relativePath: String, @McpToolParam(description = "The starting line number (1-indexed)") startLine: Int = 1, @McpToolParam(description = "The ending line number (inclusive)") endLine: Int? = null, @McpToolParam(description = "Maximum bytes to read to prevent memory issues") maxBytes: Int = 256 * 1024 * 1024): FileContentResponse
Link copied to clipboard
@Tool(description = "Read multiple files at once.")
fun readManyFiles(@McpToolParam(description = "A list of relative paths to the files") paths: List<String>): Map<String, FileContentResponse>
Link copied to clipboard
@Tool(description = "Resolve a path hint using fuzzy matching if it doesn't exist.")
fun resolvePath(@McpToolParam(description = "The path hint or partial filename to resolve") hint: String): List<String>
Link copied to clipboard
@Tool(description = "Search for files by name or glob pattern within the project. Example: searchFiles("Toolkit", "*.kt")")
fun searchFiles(@McpToolParam(description = "The text to search for in the file name") query: String, @McpToolParam(description = "The glob pattern to filter files (e.g., "**/*.kt")") glob: String = "**/*"): List<FileMetadata>
Link copied to clipboard
@Tool(description = "Search for text within files in the project. Example: searchInFiles("TODO", "**/*.kt")")
fun searchTextInFiles(@McpToolParam(description = "The text to search for within file contents") query: String, @McpToolParam(description = "The glob pattern to filter files (e.g., "**/*.kt")") glob: String = "**/*", @McpToolParam(description = "Number of surrounding lines to show for each match (default = 0)") padding: Int = 0): FileSearchResponse