Skip to main content

ToolContext

Struct ToolContext 

Source
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 PermissionChecker

The active permission checker for sub-operations the tool may perform.

§resources: &'a dyn ToolResources

Shared 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.