Skip to main content
Glama
version-fetcher.ts1.09 kB
/** * Version fetcher module * * Handles fetching and parsing of tool version information. */ import { executeTool } from './command-executor'; import { logger } from './logger'; import type { ToolInfo } from './path-scanner'; /** * Gets the version of a tool * @param tool Tool info * @param projectPath Path to execute from * @returns Promise<string> */ export async function getToolVersion(tool: ToolInfo, _projectPath: string): Promise<string> { try { const result = await executeTool(tool, ['--version'], { timeout: 2000, maxOutputSize: 1000 }); if (result.code === 0 && result.output.trim()) { return result.output.trim(); } // Try -v if --version fails const fallbackResult = await executeTool(tool, ['-v'], { timeout: 2000, maxOutputSize: 1000 }); return fallbackResult.code === 0 && fallbackResult.output.trim() ? fallbackResult.output.trim() : 'Version unknown'; } catch (error) { logger.warn(`Failed to get version for ${tool.name}:`, error); return 'Version unknown'; } }

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/patelnav/my-tools-mcp'

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