Skip to main content
Glama

Postman MCP Generator

by Ucode-io
tools.js2.2 kB
import { discoverTools } from "../lib/tools.js"; export function registerToolsCommand(program) { program .command("tools") .description("List all available API tools") .action(async () => { const tools = await discoverTools(); if (tools.length === 0) { console.log("No tools found. Tools should be organized as:"); console.log("tools/workspace/collection/request.js\n"); return; } console.log("\nAvailable Tools:\n"); // Group tools by workspace/collection const groupedTools = tools.reduce((acc, tool) => { // Extract workspace and collection from path const parts = tool.path.split("/"); const workspace = parts[1] || "Unknown Workspace"; const collection = parts[2] || "Unknown Collection"; if (!acc[workspace]) acc[workspace] = {}; if (!acc[workspace][collection]) acc[workspace][collection] = []; acc[workspace][collection].push(tool); return acc; }, {}); // Print tools in a hierarchical structure for (const [workspace, collections] of Object.entries(groupedTools)) { console.log(`Workspace: ${workspace}`); for (const [collection, tools] of Object.entries(collections)) { console.log(` Collection: ${collection}`); tools.forEach( ({ definition: { function: { name, description, parameters }, }, }) => { console.log(` ${name}`); console.log( ` Description: ${description || "No description provided"}` ); if (parameters?.properties) { console.log(" Parameters:"); Object.entries(parameters.properties).forEach( ([name, details]) => { console.log( ` - ${name}: ${ details.description || "No description" }` ); } ); } console.log(""); } ); } console.log(""); } }); }

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/Ucode-io/mcp-server'

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