list_allowed_commands
View all permitted commands on the Windows Command Line MCP Server to ensure controlled and secure command execution within the system.
Instructions
List all commands that are allowed to be executed by this server. This helps understand what operations are permitted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- index.ts:400-442 (handler)The handler function for the 'list_allowed_commands' tool. It returns a static text describing allowed commands based on the platform (Windows-specific powershell.exe and cmd.exe, or Unix alternatives). Includes error handling.async () => { try { if (isWindows) { return { content: [ { type: "text", text: "The following commands are allowed to be executed by this server:\n\n" + "- powershell.exe: Used for most system operations\n" + "- cmd.exe: Used for simple command execution\n\n" + "Note: All commands are executed with the same privileges as the user running this server." }, ], }; } else { return { content: [ { type: "text", text: "Running on non-Windows platform: " + platform() + "\n\n" + "Standard Unix/Linux commands are available, but Windows-specific commands like powershell.exe and cmd.exe are not available in this environment.\n\n" + "The following commands should work:\n" + "- ls: List directory contents\n" + "- ps: List processes\n" + "- uname: Print system information\n" + "- ip: Show network information\n\n" + "Note: All commands are executed with the same privileges as the user running this server." }, ], }; } } catch (error) { return { isError: true, content: [ { type: "text", text: `Error listing allowed commands: ${error}`, }, ], }; } }
- index.ts:396-443 (registration)Registration of the 'list_allowed_commands' tool using server.tool(), including the tool name, description, empty input schema ({}), and inline handler function.server.tool( "list_allowed_commands", "List all commands that are allowed to be executed by this server. This helps understand what operations are permitted.", {}, async () => { try { if (isWindows) { return { content: [ { type: "text", text: "The following commands are allowed to be executed by this server:\n\n" + "- powershell.exe: Used for most system operations\n" + "- cmd.exe: Used for simple command execution\n\n" + "Note: All commands are executed with the same privileges as the user running this server." }, ], }; } else { return { content: [ { type: "text", text: "Running on non-Windows platform: " + platform() + "\n\n" + "Standard Unix/Linux commands are available, but Windows-specific commands like powershell.exe and cmd.exe are not available in this environment.\n\n" + "The following commands should work:\n" + "- ls: List directory contents\n" + "- ps: List processes\n" + "- uname: Print system information\n" + "- ip: Show network information\n\n" + "Note: All commands are executed with the same privileges as the user running this server." }, ], }; } } catch (error) { return { isError: true, content: [ { type: "text", text: `Error listing allowed commands: ${error}`, }, ], }; } } );
- index.ts:399-399 (schema)Input schema for the tool: empty object indicating no input parameters are required.{},