Struct AgentData

Source
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 registered
  • mcp_level: MCP certification level (0-3, if any)
  • identity_verified: Whether identity has been verified
  • security_audit_passed: Whether security audit passed
  • open_source: Whether the agent is open source
  • total_interactions: Total number of interactions
  • total_reviews: Total number of reviews received
  • average_rating: Average rating (1.0-5.0 scale)
  • positive_reviews: Count of positive reviews
  • negative_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

Source

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 Clone for AgentData

Source§

fn clone(&self) -> AgentData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AgentData

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for AgentData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for AgentData

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,