Skip to main content
Glama
count-actual-tools.jsβ€’3.16 kB
#!/usr/bin/env node /** * Simple tool counter that gets the accurate MCP tool count * by importing the actual registry and counting tool definitions. */ import path from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); async function countActualTools() { console.log('πŸ” Counting actual MCP tools...\n'); try { // Import the actual registry - try both .js and .ts let registry; try { const registryPath = path.resolve(__dirname, '../dist/handlers/tools/registry.js'); registry = await import(registryPath); } catch (error) { // Fallback to source TypeScript file const registryPath = path.resolve(__dirname, '../src/handlers/tools/registry.ts'); registry = await import(registryPath); } if (!registry.TOOL_DEFINITIONS) { console.error('❌ TOOL_DEFINITIONS not found in registry'); return; } let totalTools = 0; const breakdown = {}; const toolList = []; // Count tools in each category Object.entries(registry.TOOL_DEFINITIONS).forEach(([category, definitions]) => { let categoryCount = 0; if (Array.isArray(definitions)) { categoryCount = definitions.length; definitions.forEach(tool => { if (tool && tool.name) { toolList.push({ name: tool.name, category }); } }); } else if (definitions && typeof definitions === 'object') { categoryCount = Object.keys(definitions).length; Object.entries(definitions).forEach(([key, tool]) => { if (tool && tool.name) { toolList.push({ name: tool.name, category, key }); } }); } if (categoryCount > 0) { breakdown[category] = categoryCount; totalTools += categoryCount; } }); // Display results console.log('πŸ“Š MCP Tool Count Results:'); console.log('========================='); console.log(`🎯 Total MCP Tools: ${totalTools}`); console.log('\nπŸ“‚ Breakdown by Category:'); Object.entries(breakdown) .sort(([,a], [,b]) => b - a) .forEach(([category, count]) => { const percentage = ((count / totalTools) * 100).toFixed(1); console.log(` ${category}: ${count} tools (${percentage}%)`); }); console.log('\nπŸ“‹ Tool List:'); toolList .sort((a, b) => a.category.localeCompare(b.category) || a.name.localeCompare(b.name)) .forEach((tool, index) => { console.log(` ${(index + 1).toString().padStart(2, '0')}. ${tool.name} (${tool.category})`); }); console.log(`\nβœ… Analysis complete: Found ${totalTools} actual MCP tools`); return { totalTools, breakdown, toolList }; } catch (error) { console.error('❌ Failed to count tools:', error.message); console.error('\nTry building the project first: npm run build'); } } // Run if called directly if (import.meta.url === `file://${process.argv[1]}`) { countActualTools(); } export default countActualTools;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kesslerio/attio-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server