block_command
Prevent specific terminal commands from executing by adding them to a blacklist using this tool, ensuring controlled command execution on your system.
Instructions
Add a command to the blacklist. Once blocked, the command cannot be executed until unblocked.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes |
Implementation Reference
- src/command-manager.ts:33-41 (handler)Core implementation of blockCommand: normalizes the command name, checks if already blocked, adds to blocked set if not, saves to config, returns success boolean.async blockCommand(command: string): Promise<boolean> { command = command.toLowerCase().trim(); if (this.blockedCommands.has(command)) { return false; } this.blockedCommands.add(command); await this.saveBlockedCommands(); return true; }
- src/server.ts:236-242 (handler)MCP tool handler/dispatcher: parses input args using schema, calls commandManager.blockCommand, returns result as text content.case "block_command": { const parsed = BlockCommandArgsSchema.parse(args); const blockResult = await commandManager.blockCommand(parsed.command); return { content: [{ type: "text", text: blockResult }], }; }
- src/server.ts:102-107 (registration)Tool registration in server's listTools response, defining name, description, and input schema.{ name: "block_command", description: "Add a command to the blacklist. Once blocked, the command cannot be executed until unblocked.", inputSchema: zodToJsonSchema(BlockCommandArgsSchema), },
- src/tools/schemas.ts:23-25 (schema)Zod schema defining input for block_command: a required 'command' string.export const BlockCommandArgsSchema = z.object({ command: z.string(), });