diff --git a/crates/mcp-edit/AGENTS.md b/crates/mcp-edit/AGENTS.md index 16d91b1..622af34 100644 --- a/crates/mcp-edit/AGENTS.md +++ b/crates/mcp-edit/AGENTS.md @@ -45,6 +45,7 @@ MCP server offering file system editing utilities. - `search_file_content` - uses `grep` crate for regex searches with optional include filters - respects git ignore + - read-only tools annotate with `readOnlyHint`: `list_directory`, `read_file`, `read_many_files`, `glob`, `search_file_content` - parameter metadata - tool parameters include descriptions and default values via rmcp - optional parameters prefix descriptions with "Optional." diff --git a/crates/mcp-edit/src/lib.rs b/crates/mcp-edit/src/lib.rs index 2e9f12a..ad2f802 100644 --- a/crates/mcp-edit/src/lib.rs +++ b/crates/mcp-edit/src/lib.rs @@ -279,7 +279,10 @@ impl FsServer { )])) } - #[tool(description = "List the contents of a directory.")] + #[tool( + description = "List the contents of a directory.", + annotations(read_only_hint = true) + )] pub async fn list_directory( &self, Parameters(params): Parameters, @@ -354,7 +357,7 @@ impl FsServer { Ok(CallToolResult::success(vec![Content::text(output)])) } - #[tool(description = "Read a file.")] + #[tool(description = "Read a file.", annotations(read_only_hint = true))] pub async fn read_file( &self, Parameters(params): Parameters, @@ -429,7 +432,10 @@ impl FsServer { } } - #[tool(description = "Read multiple files and concatenate their contents.")] + #[tool( + description = "Read multiple files and concatenate their contents.", + annotations(read_only_hint = true) + )] pub async fn read_many_files( &self, Parameters(params): Parameters, @@ -645,7 +651,10 @@ impl FsServer { ))])) } - #[tool(description = "Find files matching a glob pattern.")] + #[tool( + description = "Find files matching a glob pattern.", + annotations(read_only_hint = true) + )] pub async fn glob( &self, Parameters(params): Parameters, @@ -716,7 +725,10 @@ impl FsServer { Ok(CallToolResult::success(vec![Content::text(output)])) } - #[tool(description = "Search for a regex pattern in files within a directory.")] + #[tool( + description = "Search for a regex pattern in files within a directory.", + annotations(read_only_hint = true) + )] pub async fn search_file_content( &self, Parameters(params): Parameters, diff --git a/crates/mcp-hello/AGENTS.md b/crates/mcp-hello/AGENTS.md index 1e78d9d..e293ea1 100644 --- a/crates/mcp-hello/AGENTS.md +++ b/crates/mcp-hello/AGENTS.md @@ -14,6 +14,7 @@ Simple MCP server that provides a greeting tool. - tools - `hello` - returns "Hello, world!" + - annotated with `readOnlyHint` - server - runs over stdio - includes tools capability in MCP initialize response diff --git a/crates/mcp-hello/src/lib.rs b/crates/mcp-hello/src/lib.rs index 16d970f..7379de4 100644 --- a/crates/mcp-hello/src/lib.rs +++ b/crates/mcp-hello/src/lib.rs @@ -18,7 +18,10 @@ impl HelloServer { } } - #[tool(description = "Return a friendly greeting")] + #[tool( + description = "Return a friendly greeting", + annotations(read_only_hint = true) + )] pub async fn hello(&self) -> Result { Ok(CallToolResult::success(vec![Content::text( "Hello, world!",