Skip to main content
Glama
get-system-info.ts1.24 kB
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { z } from 'zod'; import os from 'os'; export default function getSystemInfo(server: McpServer) { server.registerTool( 'get-system-info', { title: 'Get System Information', description: 'Retrieves information about the host system, such as OS, CPU, and memory.', inputSchema: {}, }, async () => { try { const cpus = os.cpus(); const systemInfo = { platform: os.platform(), osType: os.type(), osRelease: os.release(), architecture: os.arch(), hostname: os.hostname(), totalMemoryMB: Math.round(os.totalmem() / (1024 * 1024)), freeMemoryMB: Math.round(os.freemem() / (1024 * 1024)), cpuCount: cpus.length, cpuModel: cpus.length > 0 ? cpus[0].model : 'N/A', uptimeSeconds: Math.round(os.uptime()), }; return { content: [{ type: 'text', text: JSON.stringify(systemInfo, null, 2) }], }; } catch (error: any) { return { content: [{ type: 'text', text: `An error occurred: ${error.message}` }], isError: true, }; } } ); }

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/Yussefgafer/MyMCP'

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