Skip to main content
Glama

get_system_info

Retrieve detailed system information from Windows environments using PowerShell commands. This tool enables efficient management and monitoring of system configurations, hardware, and software details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Inline handler for the 'get_system_info' tool. Executes a PowerShell command to gather system information (computer name, OS details, processor, memory, PowerShell version) using Get-ComputerInfo and $PSVersionTable, formats as JSON, and returns as text content or error.
    // Get system information this.server.tool('get_system_info', {}, async () => { try { const command = ` $ComputerInfo = Get-ComputerInfo $PSVersion = $PSVersionTable $EnvVars = Get-ChildItem Env: | Sort-Object Name $Output = [PSCustomObject]@{ ComputerName = $ComputerInfo.CsName OSName = $ComputerInfo.WindowsProductName OSVersion = $ComputerInfo.OsVersion OSBuild = $ComputerInfo.OsBuildNumber ProcessorName = $ComputerInfo.CsProcessors.Name TotalMemory = "$([math]::Round($ComputerInfo.CsTotalPhysicalMemory / 1GB, 2)) GB" PSVersion = "$($PSVersion.PSVersion)" PSEdition = "$($PSVersion.PSEdition)" PSBuildVersion = "$($PSVersion.BuildVersion)" CLRVersion = "$($PSVersion.CLRVersion)" } ConvertTo-Json -InputObject $Output -Depth 3 `; const { stdout, stderr } = await execAsync( `powershell -Command "${command.replace(/"/g, '\\"')}"` ); if (stderr) { return { isError: true, content: [ { type: 'text' as const, text: `Error retrieving system information: ${stderr}`, }, ], }; } return { content: [ { type: 'text' as const, text: stdout, }, ], }; } catch (error) { return { isError: true, content: [ { type: 'text' as const, text: `Error retrieving system information: ${(error as Error).message}`, }, ], }; } });
  • src/index.ts:80-138 (registration)
    Registers the 'get_system_info' tool with the MCP server using this.server.tool, providing an empty input schema {} and the inline async handler function.
    this.server.tool('get_system_info', {}, async () => { try { const command = ` $ComputerInfo = Get-ComputerInfo $PSVersion = $PSVersionTable $EnvVars = Get-ChildItem Env: | Sort-Object Name $Output = [PSCustomObject]@{ ComputerName = $ComputerInfo.CsName OSName = $ComputerInfo.WindowsProductName OSVersion = $ComputerInfo.OsVersion OSBuild = $ComputerInfo.OsBuildNumber ProcessorName = $ComputerInfo.CsProcessors.Name TotalMemory = "$([math]::Round($ComputerInfo.CsTotalPhysicalMemory / 1GB, 2)) GB" PSVersion = "$($PSVersion.PSVersion)" PSEdition = "$($PSVersion.PSEdition)" PSBuildVersion = "$($PSVersion.BuildVersion)" CLRVersion = "$($PSVersion.CLRVersion)" } ConvertTo-Json -InputObject $Output -Depth 3 `; const { stdout, stderr } = await execAsync( `powershell -Command "${command.replace(/"/g, '\\"')}"` ); if (stderr) { return { isError: true, content: [ { type: 'text' as const, text: `Error retrieving system information: ${stderr}`, }, ], }; } return { content: [ { type: 'text' as const, text: stdout, }, ], }; } catch (error) { return { isError: true, content: [ { type: 'text' as const, text: `Error retrieving system information: ${(error as Error).message}`, }, ], }; } });
  • Helper function promisify(exec) used by the handler to asynchronously execute the PowerShell command.
    const execAsync = promisify(exec);
  • Empty input schema for the 'get_system_info' tool (no parameters required).
    this.server.tool('get_system_info', {}, async () => {

Other Tools

Related Tools

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/posidron/mcp-powershell'

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