pub struct ToolContext {
pub workspace_dir: PathBuf,
pub root_dir: Option<PathBuf>,
pub session_id: Option<String>,
}Expand description
Context passed to tools at execution time.
This allows tools to operate on a specific workspace without being
rebuilt. When root_dir is Some, tools use it as their base directory.
When None, tools should fall back to workspace_dir.
Fields§
§workspace_dir: PathBufPrimary workspace directory (used when root_dir is None).
root_dir: Option<PathBuf>Optional explicit root directory for file tools. Takes priority over workspace_dir if present.
session_id: Option<String>Session identifier for logging/tracing.
Implementations§
Source§impl ToolContext
impl ToolContext
Sourcepub fn new(workspace_dir: impl Into<PathBuf>) -> Self
pub fn new(workspace_dir: impl Into<PathBuf>) -> Self
Create a new context with the given workspace.
Sourcepub fn root(&self) -> &Path
pub fn root(&self) -> &Path
Get the effective root directory. Returns root_dir if set, otherwise workspace_dir.
Sourcepub fn with_session(self, session_id: impl Into<String>) -> Self
pub fn with_session(self, session_id: impl Into<String>) -> Self
Set a session ID.
Trait Implementations§
Source§impl Clone for ToolContext
impl Clone for ToolContext
Source§fn clone(&self) -> ToolContext
fn clone(&self) -> ToolContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ToolContext
impl Debug for ToolContext
Auto Trait Implementations§
impl Freeze for ToolContext
impl RefUnwindSafe for ToolContext
impl Send for ToolContext
impl Sync for ToolContext
impl Unpin for ToolContext
impl UnsafeUnpin for ToolContext
impl UnwindSafe for ToolContext
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