pub struct GlobTool { /* private fields */ }Expand description
ToolExecutor that lists files matching a glob pattern.
Why: Gives agents a native, sandboxed file-discovery primitive so they stop
shelling out to find, cutting round-trips.
What: Implements ToolExecutor with name = "glob", scoped to
working_dir; rejects traversal attempts in the optional path argument.
Test: cargo test -p trusty-code -- tools::fs::glob.
Implementations§
Trait Implementations§
Source§impl ToolExecutor for GlobTool
impl ToolExecutor for GlobTool
Source§fn schema(&self) -> Value
fn schema(&self) -> Value
OpenAI function-call schema for glob.
Why: The LLM constructs its call from this schema; parameters mirror the
execute contract exactly.
What: JSON object with pattern (required) and path (optional
subdirectory to scope the walk).
Test: schema_has_required_pattern.
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 glob tool call.
Why: Enumerates files matching pattern within the working directory.
What: Parses {pattern, path?} from args, calls glob_inner, converts
the result into a ToolResult.
Test: glob_finds_files_recursively, etc.
Source§fn restricted_tiers(&self) -> &[ServiceTier]
fn restricted_tiers(&self) -> &[ServiceTier]
Auto Trait Implementations§
impl Freeze for GlobTool
impl RefUnwindSafe for GlobTool
impl Send for GlobTool
impl Sync for GlobTool
impl Unpin for GlobTool
impl UnsafeUnpin for GlobTool
impl UnwindSafe for GlobTool
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