pub struct CmdExecTool {
pub allowed_prefixes: &'static [&'static str],
}Expand description
受限命令执行工具。
当前实现默认仅允许执行 curl(包含 curl.exe),并禁止常见 shell 操作符。
Fields§
§allowed_prefixes: &'static [&'static str]允许的命令前缀白名单。
只要输入命令行以任一前缀开头(或 "{prefix} " 开头),即视为允许。
Implementations§
Source§impl CmdExecTool
impl CmdExecTool
Trait Implementations§
Source§impl Default for CmdExecTool
impl Default for CmdExecTool
Source§impl Tool for CmdExecTool
impl Tool for CmdExecTool
Source§fn description(&self) -> Option<&str>
fn description(&self) -> Option<&str>
工具描述(会作为 tool/function 定义提供给模型)。
Source§fn categories(&self) -> &'static [ToolCategory]
fn categories(&self) -> &'static [ToolCategory]
工具分类。
Source§fn input_schema(&self) -> Value
fn input_schema(&self) -> Value
输入 schema(JSON Schema)。
command:要执行的一整行命令timeout:可选超时时间(秒)
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,
执行工具 Read more
Source§fn definition(&self) -> ToolDefinition
fn definition(&self) -> ToolDefinition
获取工具定义 (ToolDefinition) Read more
Auto Trait Implementations§
impl Freeze for CmdExecTool
impl RefUnwindSafe for CmdExecTool
impl Send for CmdExecTool
impl Sync for CmdExecTool
impl Unpin for CmdExecTool
impl UnsafeUnpin for CmdExecTool
impl UnwindSafe for CmdExecTool
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