Skip to content

Commit cd6af1b

Browse files
authored
feat!: upgrade to latest MCP protocol (2025-06-18) (#29)
* feat: upgrade to protocol version 2025-06-18 * choreL update tools annotations * chore: update tests
1 parent 15121c8 commit cd6af1b

18 files changed

+90
-79
lines changed

Cargo.lock

Lines changed: 8 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ license = false
1515
eula = false
1616

1717
[dependencies]
18-
rust-mcp-sdk = { version = "0.4", default-features = false, features = [
18+
rust-mcp-sdk = { version = "0.5", default-features = false, features = [
1919
"server",
2020
"macros",
21-
"2025_03_26",
21+
"2025_06_18",
2222
] }
2323

2424
thiserror = { version = "2.0" }

src/server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub fn server_details() -> InitializeResult {
1111
server_info: Implementation {
1212
name: "rust-mcp-filesystem".to_string(),
1313
version: env!("CARGO_PKG_VERSION").to_string(),
14+
title:Some("Filesystem MCP Server: fast and efficient tools for managing filesystem operations.".to_string())
1415
},
1516
capabilities: ServerCapabilities {
1617
experimental: None,

src/tools/create_directory.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
use std::path::Path;
22

33
use rust_mcp_sdk::macros::{mcp_tool, JsonSchema};
4+
use rust_mcp_sdk::schema::TextContent;
45
use rust_mcp_sdk::schema::{schema_utils::CallToolError, CallToolResult};
56

67
use crate::fs_service::FileSystemService;
78

89
#[mcp_tool(
910
name = "create_directory",
11+
title="Create Directory",
1012
description = concat!("Create a new directory or ensure a directory exists. ",
1113
"Can create multiple nested directories in one operation. ",
1214
"If the directory already exists, this operation will succeed silently. ",
@@ -33,9 +35,8 @@ impl CreateDirectoryTool {
3335
.await
3436
.map_err(CallToolError::new)?;
3537

36-
Ok(CallToolResult::text_content(
38+
Ok(CallToolResult::text_content(vec![TextContent::from(
3739
format!("Successfully created directory {}", &params.path),
38-
None,
39-
))
40+
)]))
4041
}
4142
}

src/tools/directory_tree.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rust_mcp_sdk::macros::{mcp_tool, JsonSchema};
2+
use rust_mcp_sdk::schema::TextContent;
23
use rust_mcp_sdk::schema::{schema_utils::CallToolError, CallToolResult};
34
use serde_json::json;
45

@@ -7,6 +8,7 @@ use crate::fs_service::FileSystemService;
78

89
#[mcp_tool(
910
name = "directory_tree",
11+
title= "Directory Tree",
1012
description = concat!("Get a recursive tree view of files and directories as a JSON structure. ",
1113
"Each entry includes 'name', 'type' (file/directory), and 'children' for directories. ",
1214
"Files have no children array, while directories always have a children array (which may be empty). ",
@@ -47,6 +49,8 @@ impl DirectoryTreeTool {
4749
}
4850

4951
let json_str = serde_json::to_string_pretty(&json!(entries)).map_err(CallToolError::new)?;
50-
Ok(CallToolResult::text_content(json_str, None))
52+
Ok(CallToolResult::text_content(vec![TextContent::from(
53+
json_str,
54+
)]))
5155
}
5256
}

src/tools/edit_file.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::path::Path;
22

33
use rust_mcp_sdk::macros::{mcp_tool, JsonSchema};
4+
use rust_mcp_sdk::schema::TextContent;
45
use rust_mcp_sdk::schema::{schema_utils::CallToolError, CallToolResult};
56

67
use crate::fs_service::FileSystemService;
@@ -18,6 +19,7 @@ pub struct EditOperation {
1819

1920
#[mcp_tool(
2021
name = "edit_file",
22+
title="Edit File",
2123
description = concat!("Make line-based edits to a text file. ",
2224
"Each edit replaces exact line sequences with new content. ",
2325
"Returns a git-style diff showing the changes made. ",
@@ -53,6 +55,6 @@ impl EditFileTool {
5355
.await
5456
.map_err(CallToolError::new)?;
5557

56-
Ok(CallToolResult::text_content(diff, None))
58+
Ok(CallToolResult::text_content(vec![TextContent::from(diff)]))
5759
}
5860
}

src/tools/get_file_info.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
use std::path::Path;
22

33
use rust_mcp_sdk::macros::{mcp_tool, JsonSchema};
4+
use rust_mcp_sdk::schema::TextContent;
45
use rust_mcp_sdk::schema::{schema_utils::CallToolError, CallToolResult};
56

67
use crate::fs_service::FileSystemService;
78

89
#[mcp_tool(
910
name = "get_file_info",
11+
title="Get File Info",
1012
description = concat!("Retrieve detailed metadata about a file or directory. ",
1113
"Returns comprehensive information including size, creation time, ",
1214
"last modified time, permissions, and type. ",
@@ -32,6 +34,8 @@ impl GetFileInfoTool {
3234
.get_file_stats(Path::new(&params.path))
3335
.await
3436
.map_err(CallToolError::new)?;
35-
Ok(CallToolResult::text_content(stats.to_string(), None))
37+
Ok(CallToolResult::text_content(vec![TextContent::from(
38+
stats.to_string(),
39+
)]))
3640
}
3741
}

src/tools/list_allowed_directories.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
use rust_mcp_sdk::macros::{mcp_tool, JsonSchema};
2+
use rust_mcp_sdk::schema::TextContent;
23
use rust_mcp_sdk::schema::{schema_utils::CallToolError, CallToolResult};
34

45
use crate::fs_service::FileSystemService;
56

67
#[mcp_tool(
78
name = "list_allowed_directories",
9+
title="List Allowed Directories",
810
description = concat!("Returns a list of directories that the server has permission ",
911
"to access Subdirectories within these allowed directories are also accessible. ",
1012
"Use this to identify which directories and their nested paths are available ",
@@ -31,6 +33,8 @@ impl ListAllowedDirectoriesTool {
3133
.collect::<Vec<_>>()
3234
.join("\n")
3335
);
34-
Ok(CallToolResult::text_content(result, None))
36+
Ok(CallToolResult::text_content(vec![TextContent::from(
37+
result,
38+
)]))
3539
}
3640
}

src/tools/list_directory.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
use std::path::Path;
22

33
use rust_mcp_sdk::macros::{mcp_tool, JsonSchema};
4+
use rust_mcp_sdk::schema::TextContent;
45
use rust_mcp_sdk::schema::{schema_utils::CallToolError, CallToolResult};
56

67
use crate::fs_service::FileSystemService;
78

89
#[mcp_tool(
910
name = "list_directory",
11+
title="List Directory",
1012
description = concat!("Get a detailed listing of all files and directories in a specified path. ",
1113
"Results clearly distinguish between files and directories with [FILE] and [DIR] ",
1214
"prefixes. This tool is essential for understanding directory structure and ",
@@ -47,6 +49,8 @@ impl ListDirectoryTool {
4749
})
4850
.collect();
4951

50-
Ok(CallToolResult::text_content(formatted.join("\n"), None))
52+
Ok(CallToolResult::text_content(vec![TextContent::from(
53+
formatted.join("\n"),
54+
)]))
5155
}
5256
}

src/tools/list_directory_with_sizes.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rust_mcp_sdk::macros::{mcp_tool, JsonSchema};
2+
use rust_mcp_sdk::schema::TextContent;
23
use rust_mcp_sdk::schema::{schema_utils::CallToolError, CallToolResult};
34
use std::fmt::Write;
45
use std::path::Path;
@@ -8,6 +9,7 @@ use crate::fs_service::FileSystemService;
89

910
#[mcp_tool(
1011
name = "list_directory_with_sizes",
12+
title="List Directory With File Sizes",
1113
description = concat!("Get a detailed listing of all files and directories in a specified path, including sizes. " ,
1214
"Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. " ,
1315
"This tool is useful for understanding directory structure and " ,
@@ -86,6 +88,8 @@ impl ListDirectoryWithSizesTool {
8688
.format_directory_entries(entries)
8789
.await
8890
.map_err(CallToolError::new)?;
89-
Ok(CallToolResult::text_content(output, None))
91+
Ok(CallToolResult::text_content(vec![TextContent::from(
92+
output,
93+
)]))
9094
}
9195
}

0 commit comments

Comments
 (0)