Skip to content

Commit f950fcf

Browse files
committed
feat: upgrade to latest MCP schema version
1 parent 5740a1c commit f950fcf

15 files changed

+1569
-160
lines changed

Cargo.lock

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

Cargo.toml

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

1717
[dependencies]
18-
rust-mcp-sdk = "0.2"
19-
rust-mcp-schema = "0.4"
18+
rust-mcp-sdk = "0.3"
19+
rust-mcp-schema = "0.5"
2020

2121
thiserror = { version = "2.0" }
2222
dirs = "6.0"
@@ -25,8 +25,8 @@ walkdir = "2.5"
2525
derive_more = { version = "2.0", features = ["display", "from_str"] }
2626
similar = "=2.7"
2727
chrono = "0.4"
28-
clap = { version = "4.5.37", features = ["derive"] }
29-
tokio = "1.44"
28+
clap = { version = "4.5", features = ["derive"] }
29+
tokio = "1.4"
3030
serde = "1.0"
3131
serde_json = "1.0"
3232
async-trait = "0.1"
@@ -35,7 +35,7 @@ tokio-util = "0.7"
3535
async_zip = { version = "0.0", features = ["full"] }
3636

3737
[dev-dependencies]
38-
tempfile = "3.1"
38+
tempfile = "3.2"
3939

4040
# The profile that 'dist' will build with
4141
[profile.dist]

src/server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub fn server_details() -> InitializeResult {
1818
prompts: None,
1919
resources: None,
2020
tools: Some(ServerCapabilitiesTools { list_changed: None }),
21+
completions: None,
2122
},
2223
instructions: None,
2324
meta: None,

src/tools/create_directory.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ use crate::fs_service::FileSystemService;
1111
"Can create multiple nested directories in one operation. ",
1212
"If the directory already exists, this operation will succeed silently. ",
1313
"Perfect for setting up directory structures for projects or ensuring required paths exist. ",
14-
"Only works within allowed directories.")
14+
"Only works within allowed directories."),
15+
destructive_hint = false,
16+
idempotent_hint = false,
17+
open_world_hint = false,
18+
read_only_hint = false
1519
)]
1620
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]
1721
pub struct CreateDirectoryTool {

src/tools/directory_tree.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ use crate::fs_service::FileSystemService;
1111
description = concat!("Get a recursive tree view of files and directories as a JSON structure. ",
1212
"Each entry includes 'name', 'type' (file/directory), and 'children' for directories. ",
1313
"Files have no children array, while directories always have a children array (which may be empty). ",
14-
"The output is formatted with 2-space indentation for readability. Only works within allowed directories.")
14+
"The output is formatted with 2-space indentation for readability. Only works within allowed directories."),
15+
destructive_hint = false,
16+
idempotent_hint = false,
17+
open_world_hint = false,
18+
read_only_hint = true
1519
)]
1620
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]
1721
pub struct DirectoryTreeTool {

src/tools/edit_file.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ pub struct EditOperation {
2121
description = concat!("Make line-based edits to a text file. ",
2222
"Each edit replaces exact line sequences with new content. ",
2323
"Returns a git-style diff showing the changes made. ",
24-
"Only works within allowed directories.")
24+
"Only works within allowed directories."),
25+
destructive_hint = false,
26+
idempotent_hint = false,
27+
open_world_hint = false,
28+
read_only_hint = false
2529
)]
2630
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]
2731
pub struct EditFileTool {

src/tools/get_file_info.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ use crate::fs_service::FileSystemService;
1111
"Returns comprehensive information including size, creation time, ",
1212
"last modified time, permissions, and type. ",
1313
"This tool is perfect for understanding file characteristics without ",
14-
"reading the actual content. Only works within allowed directories.")
14+
"reading the actual content. Only works within allowed directories."),
15+
destructive_hint = false,
16+
idempotent_hint = false,
17+
open_world_hint = false,
18+
read_only_hint = true
1519
)]
1620
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]
1721
pub struct GetFileInfoTool {

src/tools/list_allowed_directories.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ use crate::fs_service::FileSystemService;
88
description = concat!("Returns a list of directories that the server has permission ",
99
"to access Subdirectories within these allowed directories are also accessible. ",
1010
"Use this to identify which directories and their nested paths are available ",
11-
"before attempting to access files.")
11+
"before attempting to access files."),
12+
destructive_hint = false,
13+
idempotent_hint = false,
14+
open_world_hint = false,
15+
read_only_hint = true
1216
)]
1317
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]
1418
pub struct ListAllowedDirectoriesTool {}

src/tools/list_directory.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ use crate::fs_service::FileSystemService;
1010
description = concat!("Get a detailed listing of all files and directories in a specified path. ",
1111
"Results clearly distinguish between files and directories with [FILE] and [DIR] ",
1212
"prefixes. This tool is essential for understanding directory structure and ",
13-
"finding specific files within a directory. Only works within allowed directories.")
13+
"finding specific files within a directory. Only works within allowed directories."),
14+
destructive_hint = false,
15+
idempotent_hint = false,
16+
open_world_hint = false,
17+
read_only_hint = true
1418
)]
1519
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]
1620
pub struct ListDirectoryTool {

src/tools/move_file.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ use crate::fs_service::FileSystemService;
1111
"and rename them in a single operation. If the destination exists, the ",
1212
"operation will fail. Works across different directories and can be used ",
1313
"for simple renaming within the same directory. ",
14-
"Both source and destination must be within allowed directories.")
14+
"Both source and destination must be within allowed directories."),
15+
destructive_hint = false,
16+
idempotent_hint = false,
17+
open_world_hint = false,
18+
read_only_hint = false
1519
)]
1620
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]
1721
pub struct MoveFileTool {

src/tools/read_files.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ use crate::fs_service::FileSystemService;
1010
description = concat!("Read the complete contents of a file from the file system. ",
1111
"Handles various text encodings and provides detailed error messages if the ",
1212
"file cannot be read. Use this tool when you need to examine the contents of ",
13-
"a single file. Only works within allowed directories.")
13+
"a single file. Only works within allowed directories."),
14+
destructive_hint = false,
15+
idempotent_hint = false,
16+
open_world_hint = false,
17+
read_only_hint = true
1418
)]
1519
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]
1620
pub struct ReadFileTool {

src/tools/read_multiple_files.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ use crate::fs_service::FileSystemService;
1212
"This is more efficient than reading files one by one when you need to analyze ",
1313
"or compare multiple files. Each file's content is returned with its ",
1414
"path as a reference. Failed reads for individual files won't stop ",
15-
"the entire operation. Only works within allowed directories.")
15+
"the entire operation. Only works within allowed directories."),
16+
destructive_hint = false,
17+
idempotent_hint = false,
18+
open_world_hint = false,
19+
read_only_hint = true
1620
)]
1721
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]
1822
pub struct ReadMultipleFilesTool {

src/tools/search_file.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ use crate::fs_service::FileSystemService;
1010
"Searches through all subdirectories from the starting path. The search ",
1111
"is case-insensitive and matches partial names. Returns full paths to all ",
1212
"matching items. Great for finding files when you don't know their exact location. ",
13-
"Only searches within allowed directories.")
13+
"Only searches within allowed directories."),
14+
destructive_hint = false,
15+
idempotent_hint = false,
16+
open_world_hint = false,
17+
read_only_hint = true
1418
)]
1519
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]
1620

src/tools/write_file.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ use crate::fs_service::FileSystemService;
88
name = "write_file",
99
description = concat!("Create a new file or completely overwrite an existing file with new content. ",
1010
"Use with caution as it will overwrite existing files without warning. ",
11-
"Handles text content with proper encoding. Only works within allowed directories.")
11+
"Handles text content with proper encoding. Only works within allowed directories."),
12+
destructive_hint = false,
13+
idempotent_hint = false,
14+
open_world_hint = false,
15+
read_only_hint = false
1216
)]
1317
#[derive(Debug, Clone, ::serde::Deserialize, ::serde::Serialize, JsonSchema)]
1418
pub struct WriteFileTool {

src/tools/zip_unzip.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ use crate::fs_service::FileSystemService;
77
name = "zip_files",
88
description = concat!("Creates a ZIP archive by compressing files. ",
99
"It takes a list of files to compress and a target path for the resulting ZIP file. ",
10-
"Both the source files and the target ZIP file should reside within allowed directories.")
10+
"Both the source files and the target ZIP file should reside within allowed directories."),
11+
destructive_hint = false,
12+
idempotent_hint = false,
13+
open_world_hint = false,
14+
read_only_hint = false
1115
)]
1216
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]
1317
pub struct ZipFilesTool {
@@ -35,7 +39,7 @@ impl ZipFilesTool {
3539
name = "unzip_file",
3640
description = "Extracts the contents of a ZIP archive to a specified target directory.
3741
It takes a source ZIP file path and a target extraction directory.
38-
The tool decompresses all files and directories stored in the ZIP, recreating their structure in the target location.
42+
The tool decompresses all files and directories stored in the ZIP, recreating their structure in the target location.
3943
Both the source ZIP file and the target directory should reside within allowed directories."
4044
)]
4145
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, JsonSchema)]

0 commit comments

Comments
 (0)