feat(mcp): enhance MCP server registration with error handling and improve transport process management
refactor: update various tools for better error handling and path resolution fix: improve markdown rendering and input display in TUI
This commit is contained in:
@@ -55,7 +55,14 @@ impl Tool for Grep {
|
||||
}
|
||||
if let Ok(content) = fs::read_to_string(file_path) {
|
||||
for (i, line) in content.lines().enumerate() {
|
||||
if line.contains(&pattern) {
|
||||
let is_match = if let Ok(re) = regex::Regex::new(&pattern) {
|
||||
re.is_match(line)
|
||||
} else {
|
||||
// Fall back to literal substring search when the
|
||||
// pattern is not a valid regex.
|
||||
line.contains(&pattern)
|
||||
};
|
||||
if is_match {
|
||||
let rel_path = file_path
|
||||
.strip_prefix(&path)
|
||||
.unwrap_or(file_path)
|
||||
|
||||
Reference in New Issue
Block a user