add_to_whitelist
Whitelist shell commands on the Super Shell MCP Server by specifying the command, security level, and description to enable secure execution across Windows, macOS, and Linux.
Instructions
Add a command to the whitelist
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | The command to whitelist | |
| description | No | Description of the command | |
| securityLevel | Yes | Security level for the command |
Input Schema (JSON Schema)
{
"properties": {
"command": {
"description": "The command to whitelist",
"type": "string"
},
"description": {
"description": "Description of the command",
"type": "string"
},
"securityLevel": {
"description": "Security level for the command",
"enum": [
"safe",
"requires_approval",
"forbidden"
],
"type": "string"
}
},
"required": [
"command",
"securityLevel"
],
"type": "object"
}
Implementation Reference
- src/index.ts:178-200 (registration)Registration of the 'add_to_whitelist' tool in the ListTools response, including name, description, and JSON schema for input validation.{ name: 'add_to_whitelist', description: 'Add a command to the whitelist', inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'The command to whitelist', }, securityLevel: { type: 'string', enum: ['safe', 'requires_approval', 'forbidden'], description: 'Security level for the command', }, description: { type: 'string', description: 'Description of the command', }, }, required: ['command', 'securityLevel'], }, },
- src/index.ts:436-468 (handler)The handler function that processes the add_to_whitelist tool call: validates input with Zod, maps security level enum, delegates to CommandService.addToWhitelist, and returns success response.* Handle add_to_whitelist tool */ private async handleAddToWhitelist(args: any) { const schema = z.object({ command: z.string(), securityLevel: z.enum(['safe', 'requires_approval', 'forbidden']), description: z.string().optional(), }); const { command, securityLevel, description } = schema.parse(args); // Map string security level to enum const securityLevelEnum = securityLevel === 'safe' ? CommandSecurityLevel.SAFE : securityLevel === 'requires_approval' ? CommandSecurityLevel.REQUIRES_APPROVAL : CommandSecurityLevel.FORBIDDEN; this.commandService.addToWhitelist({ command, securityLevel: securityLevelEnum, description, }); return { content: [ { type: 'text', text: `Command '${command}' added to whitelist with security level '${securityLevel}'`, }, ], }; }
- TypeScript interface defining the structure of a CommandWhitelistEntry used by addToWhitelist.export interface CommandWhitelistEntry { /** The command path or name */ command: string; /** Security level of the command */ securityLevel: CommandSecurityLevel; /** Allowed arguments (string for exact match, RegExp for pattern match) */ allowedArgs?: Array<string | RegExp>; /** Description of the command for documentation */ description?: string; }
- src/index.ts:439-443 (schema)Zod schema for runtime validation of tool arguments in the handler.const schema = z.object({ command: z.string(), securityLevel: z.enum(['safe', 'requires_approval', 'forbidden']), description: z.string().optional(), });
- Core helper method that stores the whitelist entry in the internal Map, implementing the whitelist addition logic.public addToWhitelist(entry: CommandWhitelistEntry): void { this.whitelist.set(entry.command, entry); }