pub struct ToolContext<'a> {
pub capability: CapabilityContext<'a>,
pub permissions: &'a dyn PermissionChecker,
pub resources: &'a dyn ToolResources,
pub cancellation: Option<TurnCancellation>,
}Expand description
Runtime context passed to every Tool::invoke call.
Provides the tool with access to session/turn metadata, the active permission checker, shared resources, and a cancellation signal so the tool can abort long-running work when a turn is cancelled.
Fields§
§capability: CapabilityContext<'a>Capability-layer context carrying session and turn identifiers.
permissions: &'a dyn PermissionCheckerThe active permission checker for sub-operations the tool may perform.
resources: &'a dyn ToolResourcesShared resources (e.g. database handles, config) injected by the host.
cancellation: Option<TurnCancellation>Signal that the current turn has been cancelled by the user.
Auto Trait Implementations§
impl<'a> Freeze for ToolContext<'a>
impl<'a> !RefUnwindSafe for ToolContext<'a>
impl<'a> Send for ToolContext<'a>
impl<'a> Sync for ToolContext<'a>
impl<'a> Unpin for ToolContext<'a>
impl<'a> UnsafeUnpin for ToolContext<'a>
impl<'a> !UnwindSafe for ToolContext<'a>
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