update_security_level
Modify the security classification of approved shell commands to control execution permissions across operating systems.
Instructions
Update the security level of a whitelisted command
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | The command to update | |
| securityLevel | Yes | New security level for the command |
Implementation Reference
- src/index.ts:473-498 (handler)MCP tool handler for 'update_security_level': validates input with Zod schema, maps string security level to CommandSecurityLevel enum, calls CommandService.updateSecurityLevel, and returns success message.private async handleUpdateSecurityLevel(args: any) { const schema = z.object({ command: z.string(), securityLevel: z.enum(['safe', 'requires_approval', 'forbidden']), }); const { command, securityLevel } = 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.updateSecurityLevel(command, securityLevelEnum); return { content: [ { type: 'text', text: `Security level for command '${command}' updated to '${securityLevel}'`, }, ], }; }
- Core helper method in CommandService that updates the security level of a whitelisted command by modifying the entry in the internal whitelist Map.public updateSecurityLevel(command: string, securityLevel: CommandSecurityLevel): void { const entry = this.whitelist.get(command); if (entry) { entry.securityLevel = securityLevel; this.whitelist.set(command, entry); } }
- src/index.ts:201-219 (registration)Registration of the 'update_security_level' tool in the MCP server's listTools response, including name, description, and input schema.{ name: 'update_security_level', description: 'Update the security level of a whitelisted command', inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'The command to update', }, securityLevel: { type: 'string', enum: ['safe', 'requires_approval', 'forbidden'], description: 'New security level for the command', }, }, required: ['command', 'securityLevel'], }, },
- Type definition enum for CommandSecurityLevel used throughout the security system.export enum CommandSecurityLevel { /** Safe commands that can be executed without approval */ SAFE = 'safe', /** Commands that require approval before execution */ REQUIRES_APPROVAL = 'requires_approval', /** Commands that are explicitly forbidden */ FORBIDDEN = 'forbidden'