pub struct BashTool { /* private fields */ }Expand description
Built-in tool that executes a shell command.
On Unix-like targets the command is passed to sh -c. On Windows the
command is passed to cmd /C, matching the platform’s native shell.
§Security
This tool executes arbitrary shell commands via the platform shell. It should only be used with trusted input. It is NOT suitable for production agents exposed to untrusted users.
Implementations§
Trait Implementations§
Source§impl AgentTool for BashTool
impl AgentTool for BashTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
Natural-language description included in the LLM prompt.
Source§fn parameters_schema(&self) -> &Value
fn parameters_schema(&self) -> &Value
JSON Schema describing the tool’s input shape, used for validation.
Source§fn requires_approval(&self) -> bool
fn requires_approval(&self) -> bool
Whether this tool requires user approval before execution.
Default is
false — tools execute immediately.Source§fn execute(
&self,
_tool_call_id: &str,
params: Value,
cancellation_token: CancellationToken,
_on_update: Option<Box<dyn Fn(AgentToolResult) + Send + Sync>>,
_state: Arc<RwLock<SessionState>>,
_credential: Option<ResolvedCredential>,
) -> ToolFuture<'_>
fn execute( &self, _tool_call_id: &str, params: Value, cancellation_token: CancellationToken, _on_update: Option<Box<dyn Fn(AgentToolResult) + Send + Sync>>, _state: Arc<RwLock<SessionState>>, _credential: Option<ResolvedCredential>, ) -> ToolFuture<'_>
Execute the tool with validated parameters. Read more
Source§fn metadata(&self) -> Option<ToolMetadata>
fn metadata(&self) -> Option<ToolMetadata>
Optional organizational metadata (namespace, version). Read more
Source§fn approval_context(&self, _params: &Value) -> Option<Value>
fn approval_context(&self, _params: &Value) -> Option<Value>
Optional rich context for the approval UI. Read more
Source§fn auth_config(&self) -> Option<AuthConfig>
fn auth_config(&self) -> Option<AuthConfig>
Optional authentication configuration for this tool. Read more
Auto Trait Implementations§
impl Freeze for BashTool
impl RefUnwindSafe for BashTool
impl Send for BashTool
impl Sync for BashTool
impl Unpin for BashTool
impl UnsafeUnpin for BashTool
impl UnwindSafe for BashTool
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