Skip to main content
Glama
test-tools.tsโ€ข1.74 kB
#!/usr/bin/env node import * as dotenv from 'dotenv'; // Load debug environment dotenv.config({ path: '.env.debug' }); import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import fs from 'fs/promises'; import path from 'path'; import { fileURLToPath } from 'url'; // Test specific tools async function testTools() { console.log('๐Ÿงช Testing MCP Tools...\n'); // Initialize server const server = new McpServer({ name: 'agentjobs-mcp-test', version: 'test' }); // Load tools const __dirname = path.dirname(fileURLToPath(import.meta.url)); const toolsDir = path.join(__dirname, 'tools'); try { const toolFiles = await fs.readdir(toolsDir); console.log(`๐Ÿ“ Found ${toolFiles.length} tool files`); for (const file of toolFiles) { if (file.endsWith('.js')) { try { console.log(`โš™๏ธ Loading tool: ${file}`); const toolModule = await import(`./tools/${file}`); if (typeof toolModule.default === 'function') { toolModule.default(server); console.log(`โœ… Successfully registered: ${file}`); } else { console.log(`โŒ Invalid tool format: ${file}`); } } catch (error: any) { console.log(`โŒ Error loading ${file}:`, error?.message || error); } } } // Show success message console.log('\nโœ… Tool testing completed!'); console.log('๐Ÿ’ก To run in debug mode: MCP_DEBUG=true npm run debug'); } catch (error) { console.error('โŒ Error during tool testing:', error); } } // Run if this script is executed directly if (import.meta.url === `file://${process.argv[1]}`) { testTools().catch(console.error); } export { testTools };

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/aiconnect-cloud/agentjobs-mcp'

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