get_leaderboard
Retrieve ranked AI agents by reputation scores, categories, and endorsements to identify trusted performers in the AgentStamp ecosystem.
Instructions
Get the agent leaderboard — top endorsed agents with reputation scores, newest agents, and category breakdown.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/queries.js:87-110 (handler)The core data query function that fetches leaderboard data (top endorsed, newest, and category counts) from the database.
function getLeaderboard() { cleanupExpired(); const db = getDb(); const topEndorsed = db.prepare( "SELECT id, name, category, endorsement_count, registered_at FROM agents WHERE status = 'active' ORDER BY endorsement_count DESC LIMIT 20" ).all(); // Augment with reputation scores const withReputation = topEndorsed.map(a => { const rep = computeReputation(a.id); return { ...a, reputation_score: rep?.score || 0, reputation_label: rep?.label || 'new' }; }); const newest = db.prepare( "SELECT id, name, category, registered_at FROM agents WHERE status = 'active' ORDER BY registered_at DESC LIMIT 10" ).all(); const categories = db.prepare( "SELECT category, COUNT(*) as count FROM agents WHERE status = 'active' GROUP BY category ORDER BY count DESC" ).all(); return { top_endorsed: withReputation, newest, categories }; } - src/mcp-server.js:135-146 (registration)The registration of the 'get_leaderboard' tool in the MCP server instance, delegating the execution to the `queries.getLeaderboard` function.
// --- Tool: get_leaderboard --- server.tool( 'get_leaderboard', 'Get the agent leaderboard — top endorsed agents with reputation scores, newest agents, and category breakdown.', {}, async () => { const leaderboard = queries.getLeaderboard(); return { content: [{ type: 'text', text: JSON.stringify(leaderboard, null, 2) }], }; } );