Skip to main content
Glama
JackXuyi

Current operating environment

getNodeInfo

Retrieve Node.js version details from the current operating environment to verify installations and check compatibility.

Instructions

获取当前设备安装的 Node.js 版本信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:271-279 (registration)
    Tool registration in the listTools handler: defines name, description, and empty input schema for getNodeInfo.
    { name: "getNodeInfo", description: "获取当前设备安装的 Node.js 版本信息", inputSchema: { type: "object", properties: {}, required: [] } }
  • Handler implementation for getNodeInfo tool: fetches Node.js version, npm version, global packages, and other runtime info using process object and execSync, returns JSON stringified response.
    case "getNodeInfo": { let nodeInfo = {}; try { // 获取 Node.js 版本信息 const nodeVersion = process.version; const nodeFullVersion = execSync('node --version').toString().trim(); const npmVersion = execSync('npm --version').toString().trim(); // 获取已安装的全局 npm 包 const globalPackages = execSync('npm list -g --depth=0 --json').toString(); const parsedGlobalPackages = JSON.parse(globalPackages); // 获取 Node.js 环境信息 nodeInfo = { version: nodeVersion, fullVersion: nodeFullVersion, npmVersion: npmVersion, platform: process.platform, arch: process.arch, globalPackages: parsedGlobalPackages.dependencies || {}, execPath: process.execPath, features: process.features, modules: process.versions }; } catch (error) { // 出错时返回基本信息 nodeInfo = { version: process.version, platform: process.platform, arch: process.arch }; } return { content: [{ type: "text", text: JSON.stringify(nodeInfo, null, 2) }] }; }

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/JackXuyi/env-mcp'

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