Skip to main content
Glama
tool-search-agents.json2.06 kB
{ "name": "Tool - Search Existing Agents", "nodes": [ { "parameters": { "httpMethod": "POST", "path": "search-agents", "options": {} }, "id": "webhook-tool-trigger", "name": "Webhook Tool Trigger", "type": "n8n-nodes-base.webhook", "typeVersion": 1.1, "position": [240, 300], "webhookId": "search-agents-tool" }, { "parameters": { "jsCode": "const query = $input.item.json.query || '';\nconst limit = $input.item.json.limit || 5;\nconst fs = require('fs');\nconst registryPath = 'C:/MCP/inventory/agent-registry.json';\nlet agents = [];\ntry {\n const data = fs.readFileSync(registryPath, 'utf8');\n const registry = JSON.parse(data);\n agents = Object.values(registry.agents || {});\n} catch (error) {\n console.log('Registry not found');\n}\nconst searchTerm = query.toLowerCase();\nconst results = agents.filter(agent => {\n const nameMatch = agent.name?.toLowerCase().includes(searchTerm);\n const descMatch = agent.description?.toLowerCase().includes(searchTerm);\n const capMatch = agent.capabilities?.some(cap => cap.toLowerCase().includes(searchTerm));\n return nameMatch || descMatch || capMatch;\n}).slice(0, limit);\nreturn {\n found: results.length > 0,\n count: results.length,\n query: query,\n agents: results\n};" }, "id": "search-code", "name": "Search Agent Registry", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [460, 300] }, { "parameters": { "respondWith": "json", "responseBody": "={{ $json }}" }, "id": "respond-with-results", "name": "Return Results", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [680, 300] } ], "connections": { "Webhook Tool Trigger": { "main": [[{"node": "Search Agent Registry", "type": "main", "index": 0}]] }, "Search Agent Registry": { "main": [[{"node": "Return Results", "type": "main", "index": 0}]] } } }

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/bermingham85/mcp-puppet-pipeline'

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