pub struct BashTool { /* private fields */ }Expand description
Tool that executes bash commands with permission checks.
Implementations§
Source§impl BashTool
impl BashTool
Sourcepub fn new(permission_registry: Arc<PermissionRegistry>) -> BashTool
pub fn new(permission_registry: Arc<PermissionRegistry>) -> BashTool
Create a new BashTool with the given permission registry.
§Arguments
permission_registry- The registry used to request and cache permissions.
Sourcepub fn with_working_dir(
permission_registry: Arc<PermissionRegistry>,
working_dir: PathBuf,
) -> BashTool
pub fn with_working_dir( permission_registry: Arc<PermissionRegistry>, working_dir: PathBuf, ) -> BashTool
Create a new BashTool with a default working directory.
§Arguments
permission_registry- The registry used to request and cache permissions.working_dir- The default working directory for commands.
Sourcepub async fn cleanup_session(&self, session_id: i64)
pub async fn cleanup_session(&self, session_id: i64)
Cleans up session-specific state when a session is removed.
This removes the working directory state for the given session, preventing unbounded memory growth from abandoned sessions.
Trait Implementations§
Source§impl Executable for BashTool
impl Executable for BashTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
Get the tool description.
Source§fn input_schema(&self) -> &str
fn input_schema(&self) -> &str
Get the input schema as JSON string.
Source§fn execute(
&self,
context: ToolContext,
input: HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send>>
fn execute( &self, context: ToolContext, input: HashMap<String, Value>, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send>>
Execute the tool with given input.
Source§fn display_config(&self) -> DisplayConfig
fn display_config(&self) -> DisplayConfig
Get display configuration for UI rendering.
Source§fn compact_summary(
&self,
input: &HashMap<String, Value>,
result: &str,
) -> String
fn compact_summary( &self, input: &HashMap<String, Value>, result: &str, ) -> String
Generate compact summary for context compaction.
Source§fn required_permissions(
&self,
context: &ToolContext,
input: &HashMap<String, Value>,
) -> Option<Vec<PermissionRequest>>
fn required_permissions( &self, context: &ToolContext, input: &HashMap<String, Value>, ) -> Option<Vec<PermissionRequest>>
Return the permissions required to execute this tool with the given input. Read more
Source§fn cleanup_session(
&self,
session_id: i64,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
fn cleanup_session( &self, session_id: i64, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
Cleans up any session-specific state when a session is removed. Read more
Source§fn to_definition(&self) -> ToolDefinition
fn to_definition(&self) -> ToolDefinition
Convert to LLM tool definition.
Source§fn to_llm_tool(&self) -> Tool
fn to_llm_tool(&self) -> Tool
Convert to LLMTool for provider APIs.
Source§fn handles_own_permissions(&self) -> bool
fn handles_own_permissions(&self) -> bool
Whether this tool handles its own permission flow internally. 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 !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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more