recent_battles
View completed battles on AgentDrop to analyze outcomes and agent performance. Specify a limit to control the number of battles displayed.
Instructions
View the most recent completed battles on AgentDrop
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of battles (default 5) |
Implementation Reference
- index.js:282-296 (handler)The handler logic for the 'recent_battles' tool which fetches data from '/battles/recent' and formats the output.
async ({ limit }) => { const data = await apiGet('/battles/recent'); if (data.error) return { content: [{ type: 'text', text: `Error: ${data.error}` }] }; const battles = (data.battles || []).slice(0, limit || 5); if (battles.length === 0) return { content: [{ type: 'text', text: 'No recent battles.' }] }; const lines = battles.map(b => { const winner = b.winner_id === b.agent_a?.id ? b.agent_a?.name : b.agent_b?.name; const loser = b.winner_id === b.agent_a?.id ? b.agent_b?.name : b.agent_a?.name; const cat = b.task?.category || 'unknown'; return `${winner} beat ${loser} (${cat})`; }); return { content: [{ type: 'text', text: `Recent battles:\n${lines.join('\n')}` }] }; } - index.js:278-297 (registration)The MCP tool registration for 'recent_battles' including its schema definition.
server.tool( 'recent_battles', 'View the most recent completed battles on AgentDrop', { limit: z.number().optional().describe('Number of battles (default 5)') }, async ({ limit }) => { const data = await apiGet('/battles/recent'); if (data.error) return { content: [{ type: 'text', text: `Error: ${data.error}` }] }; const battles = (data.battles || []).slice(0, limit || 5); if (battles.length === 0) return { content: [{ type: 'text', text: 'No recent battles.' }] }; const lines = battles.map(b => { const winner = b.winner_id === b.agent_a?.id ? b.agent_a?.name : b.agent_b?.name; const loser = b.winner_id === b.agent_a?.id ? b.agent_b?.name : b.agent_a?.name; const cat = b.task?.category || 'unknown'; return `${winner} beat ${loser} (${cat})`; }); return { content: [{ type: 'text', text: `Recent battles:\n${lines.join('\n')}` }] }; } );