get_platform_info
Retrieve current platform and shell details to enable secure cross-platform command execution with built-in security controls.
Instructions
Get information about the current platform and shell
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:525-551 (handler)The primary handler function for the 'get_platform_info' tool. It dynamically imports platform utilities, gathers platform, shell, and configuration information, and returns it as a formatted JSON response.private async handleGetPlatformInfo() { const { detectPlatform, getShellSuggestions, getCommonShellLocations } = await import('./utils/platform-utils.js'); const platform = detectPlatform(); const currentShell = this.commandService.getShell(); const shellExecutionEnabled = this.commandService.isShellEnabled(); const suggestedShells = getShellSuggestions()[platform]; const commonLocations = getCommonShellLocations(); return { content: [ { type: 'text', text: JSON.stringify({ platform, currentShell, shellExecutionEnabled, suggestedShells, commonLocations, helpMessage: shellExecutionEnabled ? `Super Shell MCP is running on ${platform} using ${currentShell} with shell parsing enabled.` : `Super Shell MCP is running on ${platform} executing commands without shell parsing.`, }, null, 2), }, ], }; }
- src/index.ts:142-148 (registration)Registers the 'get_platform_info' tool in the MCP server's tool list, including its name, description, and input schema (empty object).name: 'get_platform_info', description: 'Get information about the current platform and shell', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:144-147 (schema)Defines the input schema for the 'get_platform_info' tool as an empty object (no parameters required).inputSchema: { type: 'object', properties: {}, },
- src/utils/platform-utils.ts:19-27 (helper)Utility function to detect the current platform (WINDOWS, MACOS, LINUX, or UNKNOWN) based on process.platform.export function detectPlatform(): PlatformType { const platform = process.platform; if (platform === 'win32') return PlatformType.WINDOWS; if (platform === 'darwin') return PlatformType.MACOS; if (platform === 'linux') return PlatformType.LINUX; return PlatformType.UNKNOWN; }
- src/utils/platform-utils.ts:65-72 (helper)Utility function providing suggested shell executables for each supported platform.export function getShellSuggestions(): Record<PlatformType, string[]> { return { [PlatformType.WINDOWS]: ['cmd.exe', 'powershell.exe', 'pwsh.exe'], [PlatformType.MACOS]: ['/bin/zsh', '/bin/bash', '/bin/sh'], [PlatformType.LINUX]: ['/bin/bash', '/bin/sh', '/bin/zsh'], [PlatformType.UNKNOWN]: ['/bin/sh'] }; }
- src/utils/platform-utils.ts:78-95 (helper)Utility function returning common file paths where shell executables are typically located on the current platform.export function getCommonShellLocations(): string[] { const platform = detectPlatform(); switch (platform) { case PlatformType.WINDOWS: return [ process.env.COMSPEC || 'C:\\Windows\\System32\\cmd.exe', 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe', 'C:\\Program Files\\PowerShell\\7\\pwsh.exe' ]; case PlatformType.MACOS: return ['/bin/zsh', '/bin/bash', '/bin/sh']; case PlatformType.LINUX: return ['/bin/bash', '/bin/sh', '/usr/bin/bash', '/usr/bin/zsh']; default: return ['/bin/sh']; } }