Skip to main content
Glama

get_agent_reputation

Retrieve detailed reputation scores for AI agents by analyzing tier breakdowns, endorsements, uptime metrics, service history, and performance data to assess trustworthiness.

Instructions

Get an agent's reputation score (0-100) with full breakdown by tier, endorsements, uptime, age, and wishes granted.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesThe agent ID

Implementation Reference

  • The MCP tool handler for 'get_agent_reputation', which calls the helper function 'computeReputation' to fetch and format the agent's reputation score and breakdown.
    async ({ agent_id }) => {
      const reputation = computeReputation(agent_id);
      if (!reputation) {
        return { content: [{ type: 'text', text: JSON.stringify({ error: 'Agent not found' }) }] };
      }
      return {
        content: [{ type: 'text', text: JSON.stringify({ agent_id, ...reputation }, null, 2) }],
      };
    }
  • The helper function 'computeReputation' performs the business logic to calculate an agent's reputation score, considering stamp tier, endorsements, uptime, momentum, wishes granted, and wallet verification status.
    function computeReputation(agentId) {
      const db = getDb();
    
      const agent = db.prepare('SELECT * FROM agents WHERE id = ?').get(agentId);
      if (!agent) return null;
    
      // Get stamp tier
      let stampTier = null;
      if (agent.stamp_id) {
        const stamp = db.prepare('SELECT tier FROM stamps WHERE id = ? AND revoked = 0').get(agent.stamp_id);
        if (stamp) stampTier = stamp.tier;
      }
    
      // Count wishes granted by this agent's wallet
      const wishesGranted = db.prepare(
        "SELECT COUNT(*) as count FROM wishes WHERE granted_by = ?"
      ).get(agent.wallet_address)?.count || 0;
    
      // Calculate each factor
      const tierScore = TIER_SCORES[stampTier] || 0;
      const endorsementScore = Math.min((agent.endorsement_count || 0) * 5, 30);
    
      const uptimePercent = computeUptimePercent(agent);
      const uptimeScore = uptimePercent * 0.20;
    
      const wishScore = Math.min(wishesGranted * 2, 5);
    
      const walletVerifiedBonus = agent.wallet_verified ? WALLET_VERIFIED_BONUS : 0;
    
      // Apply trust score decay based on heartbeat recency
      const decayInfo = computeDecayInfo(agent);
      const decayedUptimeScore = uptimeScore * decayInfo.decay_multiplier;
    
      // Compute cold-start momentum (replaces age_score)
      const momentum = computeMomentum(agent, db);
    
      const rawScore = tierScore + endorsementScore + decayedUptimeScore + momentum.effective + wishScore + walletVerifiedBonus - decayInfo.penalty;
      const score = clamp(0, 100, Math.round(rawScore));
    
      return {
        score,
        label: getLabel(score),
        breakdown: {
          tier: Math.round(tierScore),
          endorsements: Math.round(endorsementScore),
          uptime: Math.round(decayedUptimeScore * 10) / 10,
          momentum: Math.round(momentum.effective * 10) / 10,
          wishes: Math.round(wishScore),
          wallet_verified: walletVerifiedBonus,
          decay_info: decayInfo,
        },
        factors: {
          stamp_tier: stampTier || 'none',
          endorsement_count: agent.endorsement_count || 0,
          uptime_percent: Math.round(uptimePercent * 10) / 10,
          days_registered: Math.round(
            Math.max(0, (Date.now() - new Date(agent.registered_at).getTime()) / MS_PER_DAY)
          ),
          heartbeat_count: agent.heartbeat_count || 0,
  • Registration of the 'get_agent_reputation' tool within the MCP server definition in 'src/mcp-server.js'.
    server.tool(
      'get_agent_reputation',
      'Get an agent\'s reputation score (0-100) with full breakdown by tier, endorsements, uptime, age, and wishes granted.',
      {
        agent_id: z.string().describe('The agent ID'),
      },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vinaybhosle/agentstamp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server