compare_tools
Compare adoption metrics between 2-3 AI developer tools like OpenAI SDK, Anthropic SDK, Cursor, GitHub Copilot, or LangChain to analyze usage trends and make informed tool selection decisions.
Instructions
Compare adoption metrics between 2-3 AI developer tools (e.g., OpenAI vs Anthropic SDK)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tools | Yes | Array of 2-3 tool IDs to compare | |
| time_range | No | Time range for comparison metrics | 30d |
Implementation Reference
- src/tools/compare.js:67-133 (handler)The async execute method that implements the core logic of the compare_tools tool. It validates input, fetches metrics from mock data, computes comparisons, and formats a readable text output with insights.async execute(args) { const { tools, time_range = '30d' } = args; // Validate tool IDs const invalidTools = tools.filter(id => !TOOLS[id]); if (invalidTools.length > 0) { throw new Error(`Unknown tools: ${invalidTools.join(', ')}`); } // Build comparison data const comparison = tools.map(id => { const tool = TOOLS[id]; const metrics = CURRENT_METRICS[id]; const growth = getGrowthMetrics(id, time_range === '90d' ? 3 : 1); return { id, name: tool.name, downloads_monthly: metrics.npm_downloads_monthly, downloads_weekly: metrics.npm_downloads_weekly, github_stars: metrics.github_stars, stackoverflow_questions: metrics.stackoverflow_questions_30d, reddit_mentions: metrics.reddit_mentions_30d, growth_pct: growth?.growth_pct || 0, last_updated: metrics.last_updated }; }); // Format output let output = `📊 AI Developer Tools Comparison\n`; output += `📅 Time Range: ${time_range}\n\n`; // NPM Downloads section output += `**NPM Downloads (Monthly)**\n`; comparison.forEach(tool => { const growthIcon = tool.growth_pct > 5 ? '↑' : tool.growth_pct < -5 ? '↓' : '↔'; output += `• ${tool.name}: ${formatNumber(tool.downloads_monthly)}/month ${growthIcon} ${tool.growth_pct.toFixed(1)}%\n`; }); output += '\n'; // Community Activity section output += `**Community Activity (Last 30 Days)**\n`; comparison.forEach(tool => { output += `• ${tool.name}:\n`; output += ` - GitHub Stars: ${formatNumber(tool.github_stars)}\n`; output += ` - Stack Overflow Questions: ${tool.stackoverflow_questions}\n`; output += ` - Reddit Mentions: ${tool.reddit_mentions}\n`; }); output += '\n'; // Summary insight const leader = comparison.reduce((prev, curr) => curr.downloads_monthly > prev.downloads_monthly ? curr : prev ); const fastestGrowing = comparison.reduce((prev, curr) => curr.growth_pct > prev.growth_pct ? curr : prev ); output += `**Key Insights**\n`; output += `• ${leader.name} leads in adoption with ${formatNumber(leader.downloads_monthly)} monthly downloads\n`; output += `• ${fastestGrowing.name} shows fastest growth at ${fastestGrowing.growth_pct.toFixed(1)}% over the period\n`; output += `\n_Data updated: ${comparison[0].last_updated}_`; return output; }
- src/tools/compare.js:33-54 (schema)JSON Schema defining the input parameters for the compare_tools tool, including 'tools' array (2-3 items from enum) and optional 'time_range'.inputSchema: { type: 'object', properties: { tools: { type: 'array', items: { type: 'string', enum: ['openai', 'anthropic', 'cursor', 'copilot', 'langchain'] }, minItems: 2, maxItems: 3, description: 'Array of 2-3 tool IDs to compare' }, time_range: { type: 'string', enum: ['7d', '30d', '90d'], default: '30d', description: 'Time range for comparison metrics' } }, required: ['tools'] },
- src/index.js:65-70 (registration)The tools array in the MCP server where compareTool is registered alongside other tools. This array is used to handle list and call requests.const tools = [ compareTool, trendingTool, historyTool, searchTool ];
- src/index.js:28-32 (registration)Import statement that brings the compareTool into the main server file for registration.// Import our tool implementations import { compareTool } from './tools/compare.js'; import { trendingTool } from './tools/trending.js'; import { historyTool } from './tools/history.js'; import { searchTool } from './tools/search.js';
- src/tools/compare.js:142-149 (helper)Helper function used by the handler to format large numbers (e.g., 36143000 → 36.1M) for readable output.function formatNumber(num) { if (num >= 1_000_000) { return `${(num / 1_000_000).toFixed(1)}M`; } else if (num >= 1_000) { return `${(num / 1_000).toFixed(0)}K`; } return num.toString(); }