Skip to main content
Glama
utils.ts1.91 kB
import { readFileSync } from "fs"; import { dirname, join } from "path"; import { fileURLToPath } from "url"; import type { OptionValues } from "commander"; export const getVersion = () => { // Get package version from package.json const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const packageJsonPath = join(__dirname, "..", "package.json"); const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")) as { version: string; }; const packageVersion = packageJson.version; return packageVersion; }; // Default tool description const defaultDescription = ` Look up information in the Knowledge Base. Use this tool when you need to: - Find relevant documents or information on specific topics - Retrieve company policies, procedures, or guidelines - Access product specifications or technical documentation - Get contextual information to answer company-specific questions - Find historical data or information about projects `.trim(); export const parseOptions = (options: OptionValues) => { if (!process.env.AGENTSET_API_KEY) throw new Error("AGENTSET_API_KEY not set"); const API_KEY = process.env.AGENTSET_API_KEY; const NAMESPACE_ID = (options.namespace || process.env.AGENTSET_NAMESPACE_ID) as string | undefined; if (!NAMESPACE_ID) throw new Error("Either pass --namespace or set AGENTSET_NAMESPACE_ID"); const tenantId = options.tenant as string | undefined; console.error("Using namespace: ", NAMESPACE_ID); if (tenantId) { console.error("Using tenant: ", tenantId); } // Use the provided description if available, otherwise use the default if (options.description) { console.error("Using overridden description"); } const description = (options.description || defaultDescription) as string; return { API_KEY, NAMESPACE_ID, tenantId, description, }; };

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/agentset-ai/mcp-server'

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