update_security_level
Modify the security level of a whitelisted macOS terminal command, setting it as safe, requiring approval, or marking it as forbidden to enhance command control and safety.
Instructions
Update the security level of a whitelisted command
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | The command to update | |
| securityLevel | Yes | New security level for the command |
Input Schema (JSON Schema)
{
"properties": {
"command": {
"description": "The command to update",
"type": "string"
},
"securityLevel": {
"description": "New security level for the command",
"enum": [
"safe",
"requires_approval",
"forbidden"
],
"type": "string"
}
},
"required": [
"command",
"securityLevel"
],
"type": "object"
}
Implementation Reference
- src/index.ts:362-388 (handler)The primary handler function for the 'update_security_level' MCP tool. Validates input arguments using Zod schema, maps security level string to enum, invokes the CommandService method to perform the update, and returns a textual success response.private async handleUpdateSecurityLevel(args: unknown) { 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}'`, }, ], }; }
- src/index.ts:145-159 (schema)JSON input schema for the 'update_security_level' tool as registered in ListTools response, defining required 'command' string and 'securityLevel' enum.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'], },
- src/index.ts:142-160 (registration)Tool registration entry in the ListTools handler, specifying name, description, and input schema for 'update_security_level'.{ 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'], }, },
- Helper method in CommandService that performs the actual update by retrieving the whitelist entry for the command and updating its securityLevel property in the Map.public updateSecurityLevel(command: string, securityLevel: CommandSecurityLevel): void { const entry = this.whitelist.get(command); if (entry) { entry.securityLevel = securityLevel; this.whitelist.set(command, entry); } }