pub struct ToolCallContext {
pub cancel: CancellationToken,
pub deadline: Option<Deadline>,
pub cwd: Option<PathBuf>,
pub session_id: Option<SessionId>,
pub agent_id: Option<AgentId>,
pub extras: Arc<HashMap<String, String>>,
}Expand description
Context passed into every tool invocation.
Fields§
§cancel: CancellationTokenCancellation token for the call / turn.
deadline: Option<Deadline>Optional absolute deadline.
cwd: Option<PathBuf>Working directory for relative paths.
session_id: Option<SessionId>Session id when known.
agent_id: Option<AgentId>Agent id when known.
extras: Arc<HashMap<String, String>>Host-defined extensions (stringly map for v1).
Implementations§
Source§impl ToolCallContext
impl ToolCallContext
Sourcepub fn with_cancel(self, cancel: CancellationToken) -> Self
pub fn with_cancel(self, cancel: CancellationToken) -> Self
Builder: set cancel token.
Sourcepub fn with_deadline(self, deadline: Deadline) -> Self
pub fn with_deadline(self, deadline: Deadline) -> Self
Builder: set deadline.
Sourcepub fn with_extras(self, extras: HashMap<String, String>) -> Self
pub fn with_extras(self, extras: HashMap<String, String>) -> Self
Builder: replace extras map.
Sourcepub fn spawn_depth(&self) -> Option<u32>
pub fn spawn_depth(&self) -> Option<u32>
Read nesting depth of the current agent (None = top-level session turn).
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
True when cancel requested or deadline expired.
Trait Implementations§
Source§impl Clone for ToolCallContext
impl Clone for ToolCallContext
Source§fn clone(&self) -> ToolCallContext
fn clone(&self) -> ToolCallContext
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 ToolCallContext
impl Debug for ToolCallContext
Auto Trait Implementations§
impl Freeze for ToolCallContext
impl RefUnwindSafe for ToolCallContext
impl Send for ToolCallContext
impl Sync for ToolCallContext
impl Unpin for ToolCallContext
impl UnsafeUnpin for ToolCallContext
impl UnwindSafe for ToolCallContext
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