pub struct Scope {
pub namespace: String,
pub protocol: String,
pub resource: String,
pub action: String,
}Expand description
A single permission scope in the format namespace:protocol:resource:action.
§Grammar (4-part)
scope = namespace ":" protocol ":" resource ":" actionEach component may be a literal value or "*" (wildcard, matches anything).
§Fields
| Field | Description | Examples |
|---|---|---|
namespace | Protocol family | mcp, a2a, idprova, http |
protocol | Sub-protocol or category within the namespace | tool, prompt, resource, agent |
resource | Specific resource (tool name, endpoint, etc.) | filesystem, search, billing |
action | Operation being requested | read, write, execute, call |
§Examples
mcp:tool:filesystem:read — read access to the filesystem MCP tool
mcp:tool:*:* — all tools, any action
mcp:tool:filesystem:* — all actions on the filesystem tool
a2a:agent:billing:execute — execute on the billing A2A agent
idprova:registry:aid:write — write AIDs to the IDProva registry
*:*:*:* — unrestricted (root delegation only)Fields§
§namespace: StringProtocol family (e.g., “mcp”, “a2a”, “idprova”).
protocol: StringSub-protocol within the namespace (e.g., “tool”, “prompt”, “agent”).
resource: StringSpecific resource targeted (e.g., “filesystem”, “billing”).
action: StringAction being requested (e.g., “read”, “write”, “execute”).
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn parse(s: &str) -> Result<Self>
pub fn parse(s: &str) -> Result<Self>
Parse a 4-part scope string namespace:protocol:resource:action.
Returns an error if the string does not contain exactly 4 colon-separated parts.
Sourcepub fn covers(&self, requested: &Scope) -> bool
pub fn covers(&self, requested: &Scope) -> bool
Check if this scope covers (permits) the requested scope.
A scope covers another if each component either matches exactly
or this scope’s component is the wildcard "*".
Sourcepub fn to_string_repr(&self) -> String
pub fn to_string_repr(&self) -> String
Convert to the canonical string representation.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Scope
impl<'de> Deserialize<'de> for Scope
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Scope
impl StructuralPartialEq for Scope
Auto Trait Implementations§
impl Freeze for Scope
impl RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnsafeUnpin for Scope
impl UnwindSafe for Scope
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