pub struct ToolGrant {
pub server_id: String,
pub tool_name: String,
pub operations: Vec<Operation>,
pub constraints: Vec<Constraint>,
pub max_invocations: Option<u32>,
pub max_cost_per_invocation: Option<MonetaryAmount>,
pub max_total_cost: Option<MonetaryAmount>,
pub dpop_required: Option<bool>,
}Expand description
Authorization for a single tool on a single server.
Fields§
§server_id: StringWhich tool server (by server_id from the manifest).
tool_name: StringWhich tool on that server.
operations: Vec<Operation>Allowed operations.
constraints: Vec<Constraint>Parameter constraints that narrow the tool’s input space.
max_invocations: Option<u32>Maximum number of invocations allowed under this grant.
max_cost_per_invocation: Option<MonetaryAmount>Maximum monetary cost per single invocation under this grant.
max_total_cost: Option<MonetaryAmount>Maximum aggregate monetary cost across all invocations under this grant.
dpop_required: Option<bool>If Some(true), the kernel requires a valid DPoP proof for every invocation. None and Some(false) both mean DPoP is not required.
Implementations§
Source§impl ToolGrant
impl ToolGrant
Sourcepub fn is_subset_of(&self, parent: &ToolGrant) -> bool
pub fn is_subset_of(&self, parent: &ToolGrant) -> bool
Returns true if self is a subset of parent.
A child grant is a subset when:
- It targets the same server and tool, unless the parent uses
*. - Its operations are a subset of the parent’s.
- Its max_invocations is no greater than the parent’s (if set).
- Its constraints are at least as restrictive (superset of constraints).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolGrant
impl<'de> Deserialize<'de> for ToolGrant
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolGrant, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolGrant, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ToolGrant
impl Serialize for ToolGrant
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ToolGrant
impl RefUnwindSafe for ToolGrant
impl Send for ToolGrant
impl Sync for ToolGrant
impl Unpin for ToolGrant
impl UnsafeUnpin for ToolGrant
impl UnwindSafe for ToolGrant
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