pub struct ListDirTool { /* private fields */ }Expand description
ToolExecutor that lists the immediate entries of a directory.
Why: Gives agents a native, sandboxed directory-listing primitive so they
stop shelling out to ls, cutting round-trips.
What: Implements ToolExecutor with name = "list_dir", scoped to
working_dir; rejects traversal attempts in the optional path argument.
Test: cargo test -p trusty-code -- tools::fs::list_dir.
Implementations§
Source§impl ListDirTool
impl ListDirTool
Trait Implementations§
Source§impl ToolExecutor for ListDirTool
impl ToolExecutor for ListDirTool
Source§fn schema(&self) -> Value
fn schema(&self) -> Value
OpenAI function-call schema for list_dir.
Why: The LLM constructs its call from this schema; parameters mirror the
execute contract exactly.
What: JSON object with an optional path (directory to list; defaults to
the working-directory root).
Test: schema_has_no_required_fields.
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute a list_dir tool call.
Why: Lists the entries of a directory within the working directory.
What: Parses the optional {path} from args, calls list_inner,
converts the result into a ToolResult.
Test: list_dir_lists_entries, etc.
Source§fn restricted_tiers(&self) -> &[ServiceTier]
fn restricted_tiers(&self) -> &[ServiceTier]
Auto Trait Implementations§
impl Freeze for ListDirTool
impl RefUnwindSafe for ListDirTool
impl Send for ListDirTool
impl Sync for ListDirTool
impl Unpin for ListDirTool
impl UnsafeUnpin for ListDirTool
impl UnwindSafe for ListDirTool
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
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>
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>
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