get_platform_info
Retrieve details about the current platform and shell environment to identify system configurations and ensure compatibility across Windows, macOS, and Linux.
Instructions
Get information about the current platform and shell
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/index.ts:525-551 (handler)The main handler function that executes the get_platform_info tool logic. It dynamically imports platform utilities, detects the platform, gets shell info from CommandService, and returns 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:141-148 (registration)Registration of the get_platform_info tool in the ListToolsRequestHandler, including name, description, and empty input schema (no parameters required).{ name: 'get_platform_info', description: 'Get information about the current platform and shell', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:144-147 (schema)Input schema definition for get_platform_info tool: an empty object since no input parameters are required.inputSchema: { type: 'object', properties: {}, },
- src/utils/platform-utils.ts:19-27 (helper)Helper function to detect the current operating system platform (Windows, macOS, Linux, or unknown). Used by the handler.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)Helper function providing suggested shell executables for each platform. Used by the handler.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)Helper function providing common shell file paths for the current platform. Used by the handler.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']; } }