pub struct ExecutionPolicy { /* private fields */ }Expand description
Every backend’s tool classification, addressed by namespaced names.
use mcp_proxy::config::{Effect, ProxyConfig};
use mcp_proxy::execution::ExecutionPolicy;
let config = ProxyConfig::parse(r#"
[proxy]
name = "gw"
[proxy.listen]
[[backends]]
name = "api"
transport = "http"
url = "http://localhost:8080"
[[backends.tool_effects]]
tools = ["get_*"]
effect = "read"
"#).unwrap();
let policy = ExecutionPolicy::from_config(&config);
assert_eq!(policy.configured("api/get_user"), Effect::Read);
assert_eq!(policy.configured("api/delete_user"), Effect::Write);Implementations§
Source§impl ExecutionPolicy
impl ExecutionPolicy
Sourcepub fn from_config(config: &ProxyConfig) -> Self
pub fn from_config(config: &ProxyConfig) -> Self
Build the table for every configured backend.
Sourcepub fn backend(&self, name: &str) -> Option<Arc<BackendEffects>>
pub fn backend(&self, name: &str) -> Option<Arc<BackendEffects>>
A backend’s classification by backend name.
Sourcepub fn configured(&self, name: &str) -> Effect
pub fn configured(&self, name: &str) -> Effect
The configured effect of a namespaced tool, ignoring arguments. A name
outside every configured backend is write.
Trait Implementations§
Source§impl Clone for ExecutionPolicy
impl Clone for ExecutionPolicy
Auto Trait Implementations§
impl Forget for ExecutionPolicy
impl Freeze for ExecutionPolicy
impl Move for ExecutionPolicy
impl RefUnwindSafe for ExecutionPolicy
impl Send for ExecutionPolicy
impl Sync for ExecutionPolicy
impl Unpin for ExecutionPolicy
impl UnsafeUnpin for ExecutionPolicy
impl UnwindSafe for ExecutionPolicywhere
RawVecInner: UnwindSafe,
Arc<BackendEffects>: UnwindSafe,
HashMap<String, Arc<BackendEffects>>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more