pub struct ToolCtx {
pub cwd: PathBuf,
pub call_id: String,
pub workspace_root: PathBuf,
pub cancel: CancellationToken,
}Expand description
The context handed to a tool for one call.
Deliberately small (ADR-0003 rejects a god-object context): just the working
directory, the id of the tool_use being answered, the workspace jail root,
and a cancellation handle. The loop builds one of these per tool call, setting
ToolCtx::call_id to the tool_use id so the produced tool_result pairs
back to it (ADR-0004).
Fields§
§cwd: PathBufThe directory the tool should treat as “current” for this call.
call_id: StringThe id of the tool_use block this call answers (the pairing link).
workspace_root: PathBufThe path jail root; the host resolves every path under this (ADR-0008).
cancel: CancellationTokenCooperative cancellation: a running tool should observe this and bail out cleanly (kill its subprocess, stop reading) when it fires.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ToolCtx
impl RefUnwindSafe for ToolCtx
impl Send for ToolCtx
impl Sync for ToolCtx
impl Unpin for ToolCtx
impl UnsafeUnpin for ToolCtx
impl UnwindSafe for ToolCtx
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