system-info
Retrieve detailed system information using PermShell MCP's tool, enabling users to access essential data for diagnostics or monitoring with explicit permission.
Instructions
Get system information
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "system-info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/shell-tools.ts:107-145 (handler)The handler function executes predefined shell commands to gather system information (OS, uptime, memory, disk, CPU) using execAsync and returns the concatenated results as text content.
async () => { try { // This command doesn't need permissions as it only retrieves read-only system info const commands = [ "uname -a", // Operating system info "uptime", // System uptime "free -h || vm_stat", // Memory usage (Linux || MacOS) "df -h | grep -v loop", // Disk usage "cat /proc/cpuinfo | grep 'model name' | head -1 || sysctl -n machdep.cpu.brand_string" // CPU info ]; const results = await Promise.all( commands.map(async (cmd) => { try { const { stdout } = await execAsync(cmd); return stdout.trim(); } catch (error) { return `Failed to execute: ${cmd}`; } }) ); return { content: [{ type: "text" as const, text: results.join("\n\n") }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { isError: true, content: [{ type: "text" as const, text: `Error retrieving system information: ${errorMessage}` }] }; } } - src/tools/shell-tools.ts:103-146 (registration)Registers the 'system-info' tool on the McpServer with name, description, empty schema, and inline handler function.
server.tool( "system-info", "Get system information", {}, async () => { try { // This command doesn't need permissions as it only retrieves read-only system info const commands = [ "uname -a", // Operating system info "uptime", // System uptime "free -h || vm_stat", // Memory usage (Linux || MacOS) "df -h | grep -v loop", // Disk usage "cat /proc/cpuinfo | grep 'model name' | head -1 || sysctl -n machdep.cpu.brand_string" // CPU info ]; const results = await Promise.all( commands.map(async (cmd) => { try { const { stdout } = await execAsync(cmd); return stdout.trim(); } catch (error) { return `Failed to execute: ${cmd}`; } }) ); return { content: [{ type: "text" as const, text: results.join("\n\n") }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { isError: true, content: [{ type: "text" as const, text: `Error retrieving system information: ${errorMessage}` }] }; } } ); - src/tools/shell-tools.ts:106-106 (schema)Empty Zod schema indicating the tool takes no input parameters.
{},