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
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | The agent ID |
Implementation Reference
- src/mcp-server.js:185-193 (handler)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) }], }; } - src/reputation.js:222-280 (helper)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, - src/mcp-server.js:179-184 (registration)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'), },