list_modules
Discover installed PowerShell modules on Windows systems, enabling easy management and retrieval of module information for streamlined scripting and system administration.
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": "list_modules"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:141-185 (handler)Inline handler and registration for the 'list_modules' tool. Executes PowerShell command 'Get-Module -ListAvailable | Select-Object Name, Version, ModuleType, Path | Sort-Object Name | ConvertTo-Json' to list available modules and returns the JSON output as text content.
this.server.tool('list_modules', {}, async () => { try { const command = ` Get-Module -ListAvailable | Select-Object Name, Version, ModuleType, Path | Sort-Object Name | ConvertTo-Json `; const { stdout, stderr } = await execAsync( `powershell -Command "${command.replace(/"/g, '\\"')}"` ); if (stderr) { return { isError: true, content: [ { type: 'text' as const, text: `Error listing PowerShell modules: ${stderr}`, }, ], }; } return { content: [ { type: 'text' as const, text: stdout, }, ], }; } catch (error) { return { isError: true, content: [ { type: 'text' as const, text: `Error listing PowerShell modules: ${(error as Error).message}`, }, ], }; } });