pub struct Search {
pub workspace: Arc<dyn Workspace>,
pub base: Option<PathBuf>,
pub confine: bool,
}Expand description
Searches file contents with a regular expression, honouring
.gitignore, or lists the files with a match, or every file. Shows each
path as read takes it from the same base: below the base when the
searched path is relative or not given, absolute when it is absolute.
Publishes what it found (SearchHits) and the files it found matches
in (FilesRead), by their resolved paths.
Fields§
§workspace: Arc<dyn Workspace>Where the files are searched.
base: Option<PathBuf>The directory searched, and a relative path is searched from;
None is the workspace’s working directory. Hits of a relative
path are shown, and published, by their paths below it.
confine: boolWhether a path that resolves outside base is refused, before
anything is searched.
Trait Implementations§
Source§impl Tool for Search
impl Tool for Search
Source§type Args = SearchArgs
type Args = SearchArgs
Typed JSON arguments.
Source§type Error = ToolExecutionError
type Error = ToolExecutionError
Typed error returned by direct calls to this tool. Read more
Source§fn description(&self) -> String
fn description(&self) -> String
Model-facing description.
Source§fn parameters(&self) -> Value
fn parameters(&self) -> Value
JSON Schema for arguments.
Source§fn annotations(&self) -> ToolAnnotations
fn annotations(&self) -> ToolAnnotations
What calling the tool does to the world, for the host’s policies
(approval, plan mode, which calls run side by side). Nothing is
stated by default, which reads as the protocol’s defaults
(
ToolAnnotations).Source§fn footprint(&self, args: &SearchArgs) -> Touches
fn footprint(&self, args: &SearchArgs) -> Touches
What a call with
args may read and change, so a host runs the
calls of one reply that touch different things side by side. The
default reads it from the annotations: a
read-only tool reads anything, any other writes anything.Source§async fn call(
&self,
context: &mut ToolContext,
args: SearchArgs,
) -> Result<String, ToolExecutionError>
async fn call( &self, context: &mut ToolContext, args: SearchArgs, ) -> Result<String, ToolExecutionError>
Execute the tool.
Auto Trait Implementations§
impl !RefUnwindSafe for Search
impl !UnwindSafe for Search
impl Freeze for Search
impl Send for Search
impl Sync for Search
impl Unpin for Search
impl UnsafeUnpin for Search
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