pub struct FileWriteTool { /* private fields */ }Expand description
文件写入工具:写入文件内容。
安全限制:
- 仅允许写入白名单扩展名的文件
- 禁止访问系统敏感路径
- 支持配置允许的工作目录
输入格式:
{
"path": "/path/to/file",
"content": "文件内容"
}Implementations§
Source§impl FileWriteTool
impl FileWriteTool
Sourcepub fn with_allowed_dirs(self, dirs: Vec<PathBuf>) -> Self
pub fn with_allowed_dirs(self, dirs: Vec<PathBuf>) -> Self
设置允许的工作目录
Sourcepub fn with_max_file_size(self, size: u64) -> Self
pub fn with_max_file_size(self, size: u64) -> Self
设置最大文件大小
Trait Implementations§
Source§impl Default for FileWriteTool
impl Default for FileWriteTool
Source§impl Tool for FileWriteTool
impl Tool for FileWriteTool
Source§fn description(&self) -> Option<&str>
fn description(&self) -> Option<&str>
返回工具描述。
Source§fn categories(&self) -> &'static [ToolCategory]
fn categories(&self) -> &'static [ToolCategory]
返回工具分类。
Source§fn input_schema(&self) -> Value
fn input_schema(&self) -> Value
返回输入参数的 JSON Schema。
Source§fn call<'life0, 'async_trait>(
&'life0 self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn call<'life0, 'async_trait>(
&'life0 self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
执行工具的核心逻辑。
Source§fn definition(&self) -> ToolDefinition
fn definition(&self) -> ToolDefinition
获取工具定义 (ToolDefinition) Read more
Auto Trait Implementations§
impl Freeze for FileWriteTool
impl RefUnwindSafe for FileWriteTool
impl Send for FileWriteTool
impl Sync for FileWriteTool
impl Unpin for FileWriteTool
impl UnsafeUnpin for FileWriteTool
impl UnwindSafe for FileWriteTool
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