deny_command
Block a pending shell command on the Super Shell MCP Server by specifying its ID and providing a reason for denial, ensuring secure command execution across Windows, macOS, and Linux.
Instructions
Deny a pending command
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commandId | Yes | ID of the command to deny | |
| reason | No | Reason for denial |
Input Schema (JSON Schema)
{
"properties": {
"commandId": {
"description": "ID of the command to deny",
"type": "string"
},
"reason": {
"description": "Reason for denial",
"type": "string"
}
},
"required": [
"commandId"
],
"type": "object"
}
Implementation Reference
- src/index.ts:650-689 (handler)The main handler function for the 'deny_command' tool. Validates input using Zod schema, logs the attempt, calls commandService.denyCommand, and returns a success or error response.private async handleDenyCommand(args: any) { const schema = z.object({ commandId: z.string(), reason: z.string().optional(), }); logger.debug(`handleDenyCommand called with args: ${JSON.stringify(args)}`); const { commandId, reason } = schema.parse(args); logger.debug(`[Denial Attempt] ID: ${commandId}, Reason: ${reason || 'none provided'}`); try { this.commandService.denyCommand(commandId, reason); logger.info(`Command denied: ID: ${commandId}, Reason: ${reason || 'none provided'}`); return { content: [ { type: 'text', text: `Command denied${reason ? `: ${reason}` : ''}`, }, ], }; } catch (error) { logger.error(`[Denial Error] ID: ${commandId}, Error: ${error instanceof Error ? error.message : 'Unknown error'}`); if (error instanceof Error) { return { content: [ { type: 'text', text: `Command denial failed: ${error.message}`, }, ], isError: true, }; } throw error; }
- src/index.ts:256-272 (schema)The tool registration object defining the 'deny_command' tool, including its name, description, and input schema for MCP tool protocol.{ name: 'deny_command', description: 'Deny a pending command', inputSchema: { type: 'object', properties: { commandId: { type: 'string', description: 'ID of the command to deny', }, reason: { type: 'string', description: 'Reason for denial', }, }, required: ['commandId'], },
- src/index.ts:299-300 (registration)Dispatch case in the main tool request handler that routes 'deny_command' calls to the specific handleDenyCommand method.case 'deny_command': return await this.handleDenyCommand(args);
- The core denyCommand method in CommandService that removes the pending command from the queue, emits a denied event, and rejects the associated promise.public denyCommand(commandId: string, reason: string = 'Command denied'): void { const pendingCommand = this.pendingCommands.get(commandId); if (!pendingCommand) { throw new Error(`No pending command with ID: ${commandId}`); } // Remove from pending queue this.pendingCommands.delete(commandId); // Emit event for denied command this.emit('command:denied', { commandId, reason }); // Reject the original promise pendingCommand.reject(new Error(reason)); }