get_system_info
Retrieve system information to monitor performance, check resources, and diagnose issues in MCP server implementations.
Instructions
Get system information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:233-246 (handler)The handler function that implements get_system_info tool logic, collecting system details using platform and psutil libraries and returning as JSON.async def get_system_info(self) -> list[types.TextContent]: """Get system information""" info = { "platform": platform.system(), "arch": platform.machine(), "hostname": platform.node(), "cpus": psutil.cpu_count(), "totalMemory": f"{round(psutil.virtual_memory().total / (1024**3))} GB", "freeMemory": f"{round(psutil.virtual_memory().available / (1024**3))} GB", "uptime": f"{round(psutil.boot_time())} seconds", "pythonVersion": sys.version, "currentDirectory": str(Path.cwd()), } return [types.TextContent(type="text", text=json.dumps(info, indent=2))]
- server.js:270-291 (handler)The handler function implementing get_system_info tool, gathering Node.js os module system information and returning formatted JSON response.async getSystemInfo() { const info = { platform: os.platform(), arch: os.arch(), hostname: os.hostname(), cpus: os.cpus().length, totalMemory: Math.round(os.totalmem() / 1024 / 1024 / 1024) + ' GB', freeMemory: Math.round(os.freemem() / 1024 / 1024 / 1024) + ' GB', uptime: Math.round(os.uptime() / 3600) + ' hours', nodeVersion: process.version, currentDirectory: process.cwd(), }; return { content: [ { type: 'text', text: JSON.stringify(info, null, 2), }, ], }; }
- server.py:118-125 (schema)Schema definition for the get_system_info tool in the list_tools handler, specifying no input parameters.types.Tool( name="get_system_info", description="Get system information", inputSchema={ "type": "object", "properties": {}, }, ),
- server.js:90-97 (schema)Schema for get_system_info tool returned by listToolsRequestHandler, with empty properties indicating no args needed.{ name: 'get_system_info', description: 'Get system information', inputSchema: { type: 'object', properties: {}, }, },
- server.py:181-182 (registration)Registration/dispatch in the call_tool handler for invoking get_system_info.elif name == "get_system_info": return await self.get_system_info()