OpenAgentID documentation
Source referencesRust module referenceopenagent-mcp

openagent-mcp · skills

Declared module signatures, types, configuration, and source documentation.

Source: openagent-sdk/integrations/mcp/rust/src/skills.rs. SHA-256: 3f20542523a5bba4da4bbccb5f14e50431ae45505dc1251e2194c7344e44a684.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

skills::DEFAULT_SKILL_TOOL_NAMES

Tool name prefixes the middleware treats as skill-like by default.

pub const DEFAULT_SKILL_TOOL_NAMES: &[&str];

Source line: 21.

skills::SkillsRule

A single rule mapping a skill name to the DIDs allowed to invoke it. dids: None means "any verified caller".

#[derive(Debug, Clone)]
pub struct SkillsRule {
/// The skill name as it appears in SKILLS.md.

pub skill_name: String,
/// DIDs allowed to invoke this skill, or `None` for any.

pub dids: Option<Vec<String>>,
/// Optional human-readable reason returned on denial.

pub reason: Option<String>
}

Source line: 32.

skills::SkillsPolicyDecision

Decision returned by [SkillsPolicy::decide].

#[derive(Debug, Clone)]
pub struct SkillsPolicyDecision {
/// Whether to allow the call.

pub allow: bool,
/// Optional reason — set on denial.

pub reason: Option<String>
}

Source line: 43.

skills::SkillsPolicyDecision::allow

Build an allow decision.

pub fn allow() -> Self;

Source line: 52.

skills::SkillsPolicyDecision::deny

Build a deny decision with a reason.

pub fn deny(reason: impl Into<String>) -> Self;

Source line: 60.

skills::SkillsStore

Storage backend for skills rules. Implementations may be in-memory, file-backed, or fetched from a remote service.

#[async_trait]
pub trait SkillsStore: Send + Sync {
    /// Look up the rule for a given skill name. Return `None` if no
    /// rule is configured.
    async fn lookup(&self, skill_name: &str) -> Option<SkillsRule>;
}

Source line: 71.

skills::InMemorySkillsStore

In-memory store. Construct from a list of rules and pass to [SkillsPolicy::new].

#[derive(Debug, Default)]
pub struct InMemorySkillsStore {

}

Source line: 80.

skills::InMemorySkillsStore::new

Build a store from a list of rules.

pub fn new(rules: impl IntoIterator<Item = SkillsRule>) -> Self;

Source line: 86.

skills::InMemorySkillsStore::with_rule

Return a NEW store with the given rule applied (immutable update — the original is left untouched).

pub fn with_rule(&self, rule: SkillsRule) -> Self;

Source line: 96.

skills::SkillNameExtractor

Configurable matcher: returns the skill name if a tool call should be checked against the skills policy, or None to skip the check.

pub type SkillNameExtractor = Arc<dyn Fn(&str, &serde_json::Value) -> Option<String> + Send + Sync>;

Source line: 112.

skills::SkillsPolicy

The skills policy hook.

Construct via [SkillsPolicy::new]. The policy decides per call whether the tool is skill-like, looks up a rule from the configured store, and matches the verified DID against the rule.

#[derive(Clone)]
pub struct SkillsPolicy {

}

Source line: 120.

skills::SkillsPolicy::new

Build a policy from a store, using the default skill-name extractor that:

  • Treats the tool as a skill if its name is in [DEFAULT_SKILL_TOOL_NAMES].
  • Reads args["skill"] or args["skillName"] for the skill name.
pub fn new(store: Arc<dyn SkillsStore>) -> Self;

Source line: 139.

skills::SkillsPolicy::with_extractor

Override the extractor with a custom matcher.

pub fn with_extractor(mut self, extractor: SkillNameExtractor) -> Self;

Source line: 147.

skills::SkillsPolicy::decide

Decide whether a call should be allowed.

pub async fn decide(
        &self,
        tool_name: &str,
        args: &serde_json::Value,
        identity: &VerifiedIdentity,
    ) -> SkillsPolicyDecision;

Source line: 153.

On this page