Skip to main content

FilesystemServer

Struct FilesystemServer 

Source
pub struct FilesystemServer {
    pub allowed_directories: Vec<PathBuf>,
    pub create_backup_files: bool,
}

Fields§

§allowed_directories: Vec<PathBuf>§create_backup_files: bool

Implementations§

Source§

impl FilesystemServer

Source

pub fn new() -> Self

Source

pub fn is_path_allowed(&self, path: &Path) -> bool

Source

pub fn validate_path(&self, path: &str) -> Result<PathBuf, String>

Source

pub fn read_file( &self, path: &str, offset: Option<usize>, limit: Option<usize>, encoding: Option<&str>, ) -> Result<Value, String>

Source

pub fn write_file( &mut self, path: &str, content: &str, encoding: Option<&str>, create_backup: Option<bool>, ) -> Result<(), String>

Source

pub fn delete_file(&self, path: &str) -> Result<(), String>

Source

pub fn list_directory(&self, path: &str) -> Result<Value, String>

Source

pub fn search_files( &self, pattern: &str, path: &str, ignore_gitignore: Option<bool>, ) -> Result<Value, String>

Source

pub fn copy_file(&self, source: &str, destination: &str) -> Result<(), String>

Source

pub fn move_file(&self, source: &str, destination: &str) -> Result<(), String>

Source

pub fn create_directory( &self, path: &str, recursive: Option<bool>, ) -> Result<(), String>

Source

pub fn delete_directory( &self, path: &str, recursive: Option<bool>, ) -> Result<(), String>

Source

pub fn copy_directory( &self, source: &str, destination: &str, ) -> Result<(), String>

Source

pub fn move_directory( &self, source: &str, destination: &str, ) -> Result<(), String>

Source

pub fn replace_text( &mut self, path: &str, old_text: &str, new_text: &str, create_backup: Option<bool>, ) -> Result<Value, String>

Source

pub fn replace_line( &mut self, path: &str, line_number: usize, new_line: &str, create_backup: Option<bool>, ) -> Result<Value, String>

Source

pub fn handle_request(&mut self, request: McpRequest) -> Option<McpResponse>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.