pub struct AgentData {
pub did: String,
pub created_at: DateTime<Utc>,
pub mcp_level: Option<u8>,
pub identity_verified: bool,
pub security_audit_passed: bool,
pub open_source: bool,
pub total_interactions: u32,
pub total_reviews: u32,
pub average_rating: Option<f64>,
pub positive_reviews: u32,
pub negative_reviews: u32,
}
Expand description
Represents an MCP agent with all reputation-relevant data
This struct contains all the information needed to calculate a reputation score for an agent, including credentials, review statistics, and verification status.
§Fields
did
: Decentralized identifier (must follow did:method:identifier format)created_at
: When the agent was first registeredmcp_level
: MCP certification level (0-3, if any)identity_verified
: Whether identity has been verifiedsecurity_audit_passed
: Whether security audit passedopen_source
: Whether the agent is open sourcetotal_interactions
: Total number of interactionstotal_reviews
: Total number of reviews receivedaverage_rating
: Average rating (1.0-5.0 scale)positive_reviews
: Count of positive reviewsnegative_reviews
: Count of negative reviews
§Example
use reputation_types::AgentData;
use chrono::Utc;
let agent = AgentData {
did: "did:example:123".to_string(),
created_at: Utc::now(),
mcp_level: Some(2),
identity_verified: true,
security_audit_passed: false,
open_source: true,
total_interactions: 500,
total_reviews: 100,
average_rating: Some(4.2),
positive_reviews: 80,
negative_reviews: 20,
};
Fields§
§did: String
Decentralized identifier for the agent
created_at: DateTime<Utc>
When the agent was created/registered
mcp_level: Option<u8>
MCP certification level (0-3)
identity_verified: bool
Whether the agent’s identity has been verified
security_audit_passed: bool
Whether the agent passed security audit
open_source: bool
Whether the agent is open source
total_interactions: u32
Total number of interactions with users
total_reviews: u32
Total number of reviews received
average_rating: Option<f64>
Average rating on 1-5 scale
positive_reviews: u32
Number of positive reviews
negative_reviews: u32
Number of negative reviews
Implementations§
Source§impl AgentData
impl AgentData
Sourcepub fn builder(did: impl Into<String>) -> AgentDataBuilder
pub fn builder(did: impl Into<String>) -> AgentDataBuilder
Creates a new builder for constructing AgentData instances.
§Examples
use reputation_types::AgentData;
let agent = AgentData::builder("did:example:123")
.total_interactions(150)
.mcp_level(2)
.identity_verified(true)
.with_reviews(100, 4.5)
.build()
.unwrap();
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AgentData
impl<'de> Deserialize<'de> for AgentData
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
Auto Trait Implementations§
impl Freeze for AgentData
impl RefUnwindSafe for AgentData
impl Send for AgentData
impl Sync for AgentData
impl Unpin for AgentData
impl UnwindSafe for AgentData
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