approve_command_type
Authorize specific command types (read, write, system) for secure terminal access during AI assistant sessions, enabling controlled system interaction with session-based permissions.
Instructions
Approve a command type for the current session.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command_type | Yes | The command type to approve (read, write, system) | |
| session_id | Yes | The session ID | |
| remember | No | Whether to remember this approval |
Implementation Reference
- temp/src/cmd_line_mcp/server.py:487-515 (handler)The MCP tool handler function for 'approve_command_type', which handles user input, validates the command type, and calls the session manager.
async def approve_command_type( command_type: str, session_id: str, remember: bool = False ) -> Dict[str, Any]: """ Approve a command type for the current session. Args: command_type: The command type to approve (read, write, system) session_id: The session ID remember: Whether to remember this approval for the session Returns: A dictionary with approval status """ if command_type not in ["read", "write", "system"]: return { "success": False, "message": f"Invalid command type: {command_type}", } if remember: self.session_manager.approve_command_type(session_id, command_type) return { "success": True, "message": f"Command type '{command_type}' approved for this session", } else: return { "success": True, - The session manager's method that performs the actual persistence of the approved command type for a given session.
def approve_command_type(self, session_id: str, command_type: str) -> None: """Approve a command type for a session. Args: session_id: The session ID command_type: The command type to approve """ session = self.get_session(session_id) session["approved_command_types"].add(command_type) def has_directory_approval(self, session_id: str, directory: str) -> bool: