pub trait PermissionRequest: Send + Sync {
// Required methods
fn kind(&self) -> &'static str;
fn summary(&self) -> String;
fn metadata(&self) -> &MetadataMap;
fn as_any(&self) -> &dyn Any;
}Expand description
A description of an operation that requires permission before it can proceed.
Tool implementations return PermissionRequest objects from
Tool::proposed_requests so the executor can evaluate them against the
active PermissionChecker before invoking the tool.
Built-in implementations include ShellPermissionRequest,
FileSystemPermissionRequest, and McpPermissionRequest.
§Implementing a custom request
use std::any::Any;
use agentkit_core::MetadataMap;
use agentkit_tools_core::PermissionRequest;
struct NetworkPermissionRequest {
url: String,
metadata: MetadataMap,
}
impl PermissionRequest for NetworkPermissionRequest {
fn kind(&self) -> &'static str { "network.http" }
fn summary(&self) -> String { format!("HTTP request to {}", self.url) }
fn metadata(&self) -> &MetadataMap { &self.metadata }
fn as_any(&self) -> &dyn Any { self }
}Required Methods§
Sourcefn kind(&self) -> &'static str
fn kind(&self) -> &'static str
A dot-separated category string (e.g. "filesystem.write", "shell.command").
Sourcefn metadata(&self) -> &MetadataMap
fn metadata(&self) -> &MetadataMap
Arbitrary metadata attached to this request.