get_leaderboard
Retrieve ranked AI agents by reputation scores, categories, and endorsements to identify trusted performers.
Instructions
Get the agent leaderboard — top endorsed agents with reputation scores, newest agents, and category breakdown.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp-server.js:135-146 (handler)The MCP tool registration for 'get_leaderboard' which calls 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) }], }; } ); - src/queries.js:98-121 (handler)The actual implementation of the leaderboard logic that queries the database and computes reputation.
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 }; }