pub struct FilesystemServer {
pub allowed_directories: Vec<PathBuf>,
pub create_backup_files: bool,
}Fields§
§allowed_directories: Vec<PathBuf>§create_backup_files: boolImplementations§
Source§impl FilesystemServer
impl FilesystemServer
pub fn new() -> Self
pub fn is_path_allowed(&self, path: &Path) -> bool
pub fn validate_path(&self, path: &str) -> Result<PathBuf, String>
pub fn read_file( &self, path: &str, offset: Option<usize>, limit: Option<usize>, encoding: Option<&str>, ) -> Result<Value, String>
pub fn write_file( &mut self, path: &str, content: &str, encoding: Option<&str>, create_backup: Option<bool>, ) -> Result<(), String>
pub fn delete_file(&self, path: &str) -> Result<(), String>
pub fn list_directory(&self, path: &str) -> Result<Value, String>
pub fn search_files( &self, pattern: &str, path: &str, ignore_gitignore: Option<bool>, ) -> Result<Value, String>
pub fn copy_file(&self, source: &str, destination: &str) -> Result<(), String>
pub fn move_file(&self, source: &str, destination: &str) -> Result<(), String>
pub fn create_directory( &self, path: &str, recursive: Option<bool>, ) -> Result<(), String>
pub fn delete_directory( &self, path: &str, recursive: Option<bool>, ) -> Result<(), String>
pub fn copy_directory( &self, source: &str, destination: &str, ) -> Result<(), String>
pub fn move_directory( &self, source: &str, destination: &str, ) -> Result<(), String>
pub fn replace_text( &mut self, path: &str, old_text: &str, new_text: &str, create_backup: Option<bool>, ) -> Result<Value, String>
pub fn replace_line( &mut self, path: &str, line_number: usize, new_line: &str, create_backup: Option<bool>, ) -> Result<Value, String>
pub fn handle_request(&mut self, request: McpRequest) -> Option<McpResponse>
Auto Trait Implementations§
impl Freeze for FilesystemServer
impl RefUnwindSafe for FilesystemServer
impl Send for FilesystemServer
impl Sync for FilesystemServer
impl Unpin for FilesystemServer
impl UnsafeUnpin for FilesystemServer
impl UnwindSafe for FilesystemServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more