Skip to main content

PermissionHook

Trait PermissionHook 

Source
pub trait PermissionHook: Send + Sync {
    // Required method
    fn check<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tool_name: &'life1 str,
        args: &'life2 Value,
    ) -> Pin<Box<dyn Future<Output = PermissionDecision> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Goal-161: runtime permission hook. Implement this trait to intercept every tool invocation before it runs.

  • PermissionDecision::Allow — let the call proceed unchanged.
  • [PermissionDecision::Deny(reason)] — block and return the reason as a tool error.
  • [PermissionDecision::Transform(args)] — replace the arguments before execution.

When no hook is registered all tools are allowed.

Required Methods§

Source

fn check<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tool_name: &'life1 str, args: &'life2 Value, ) -> Pin<Box<dyn Future<Output = PermissionDecision> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called before every tool dispatch.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§