Skip to content

Commit 41e9297

Browse files
committed
Merge branch 'main' of github.com:rust-mcp-stack/rust-mcp-filesystem into feat/update-to-mcp-2025-11-25
2 parents ab553c1 + 8656d9f commit 41e9297

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/fs_service/io/read.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl FileSystemService {
130130
let start_pos = if line_count <= n {
131131
0 // Read from start if fewer than n lines
132132
} else {
133-
*newline_positions.get(line_count - n).unwrap_or(&0) + 1
133+
*newline_positions.get(n-1).unwrap_or(&0) + 1
134134
};
135135

136136
// Read forward from start_pos

src/tools/tail_file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use crate::fs_service::FileSystemService;
2929
pub struct TailFile {
3030
/// The path of the file to get information for.
3131
pub path: String,
32-
/// The number of lines to read from the beginning of the file.
32+
/// The number of lines to read from the ending of the file.
3333
pub lines: u64,
3434
}
3535

tests/test_fs_service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,13 +1321,13 @@ async fn test_tail_file_normal() {
13211321
let file_path = create_test_file_with_line_ending(
13221322
&temp_dir.to_path_buf(),
13231323
"dir1/test.txt",
1324-
vec!["line1", "line2", "line3", "line4", "line5"],
1324+
vec!["line1", "line2", "line3", "line4", "line5", "line6"],
13251325
"\n",
13261326
)
13271327
.await;
13281328

13291329
let result = service.tail_file(&file_path, 3).await.unwrap();
1330-
assert_eq!(result, "line3\nline4\nline5"); // No trailing newline
1330+
assert_eq!(result, "line4\nline5\nline6"); // No trailing newline
13311331
}
13321332

13331333
#[tokio::test]

0 commit comments

Comments
 (0)