get_node_version
Check the Node.js version of your local environment to verify runtime compatibility and ensure proper execution of Node-based applications.
Instructions
Returns the Node.js version information of the environment running the MCP server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/node-version.ts:23-32 (handler)The anonymous async handler function for the 'get_node_version' tool. It invokes getNodeVersionInfo(), formats the result as JSON, and returns it in the MCP response format.async () => { // Error handling simplified, process.version/versions are generally safe const versionInfo = getNodeVersionInfo(); return { content: [{ type: "text", text: JSON.stringify(versionInfo, null, 2) // Keep JSON for structured data }] }; }
- src/mcp/node-version.ts:19-34 (registration)The registration function that defines and registers the 'get_node_version' tool with the MCP server, including name, description, and handler.export function registerNodeVersionTool(server: McpServer): void { server.tool( "get_node_version", "Returns the Node.js version information of the environment running the MCP server.", async () => { // Error handling simplified, process.version/versions are generally safe const versionInfo = getNodeVersionInfo(); return { content: [{ type: "text", text: JSON.stringify(versionInfo, null, 2) // Keep JSON for structured data }] }; } ); }
- src/mcp/node-version.ts:3-6 (schema)TypeScript interface defining the shape of the Node.js version information returned by the helper function.interface INodeVersionInfo { nodeVersion: string; details: NodeJS.ProcessVersions; }
- src/mcp/node-version.ts:12-17 (helper)Helper function that retrieves the current Node.js version string and detailed versions object from the process object.export function getNodeVersionInfo(): INodeVersionInfo { // Export for testing return { nodeVersion: process.version, details: process.versions, }; }
- src/index.ts:22-22 (registration)Invocation of the registerNodeVersionTool function in the main server initialization, effectively registering the tool.registerNodeVersionTool(server);