pub struct FileTool { /* private fields */ }Expand description
File read/write tool (confined to the base_path sandbox, extension whitelist, size limit)
Implementations§
Source§impl FileTool
impl FileTool
Sourcepub fn with_allowed_extensions(self, exts: Vec<String>) -> Self
pub fn with_allowed_extensions(self, exts: Vec<String>) -> Self
Sets the extension whitelist (builder style).
Sourcepub fn with_max_size(self, size: usize) -> Self
pub fn with_max_size(self, size: usize) -> Self
Sets the maximum file size (bytes, builder style).
Sourcepub async fn read(&self, path: &str) -> Result<String, ToolError>
pub async fn read(&self, path: &str) -> Result<String, ToolError>
Reads a file inside the sandbox (bounded by path-escape and size checks).
Trait Implementations§
Source§impl BaseTool for FileTool
impl BaseTool for FileTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
Returns the tool description. Read more
Source§fn run<'life0, 'async_trait>(
&'life0 self,
input: String,
) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 self,
input: String,
) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool (string version). Read more
Source§fn return_direct(&self) -> bool
fn return_direct(&self) -> bool
Whether to return result directly to user. Read more
Source§fn risk(&self) -> ToolRiskProfile
fn risk(&self) -> ToolRiskProfile
Declared Rule-of-Two risk profile (A2, v0.22.1). Read more
Auto Trait Implementations§
impl Freeze for FileTool
impl RefUnwindSafe for FileTool
impl Send for FileTool
impl Sync for FileTool
impl Unpin for FileTool
impl UnsafeUnpin for FileTool
impl UnwindSafe for FileTool
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