pub struct FileReadTool { /* private fields */ }Expand description
文件读取工具:读取文件内容。
安全限制:
- 仅允许读取白名单扩展名的文件
- 禁止访问系统敏感路径
- 支持配置允许的工作目录
输入格式:
{
"path": "/path/to/file"
}Implementations§
Source§impl FileReadTool
impl FileReadTool
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 FileReadTool
impl Default for FileReadTool
Source§impl Tool for FileReadTool
impl Tool for FileReadTool
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 FileReadTool
impl RefUnwindSafe for FileReadTool
impl Send for FileReadTool
impl Sync for FileReadTool
impl Unpin for FileReadTool
impl UnsafeUnpin for FileReadTool
impl UnwindSafe for FileReadTool
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