Skip to main content
Glama

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
NameRequiredDescriptionDefault
command_typeYesThe command type to approve (read, write, system)
session_idYesThe session ID
rememberNoWhether to remember this approval

Implementation Reference

  • 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:

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wwqdrh/MCPcmd'

If you have feedback or need assistance with the MCP directory API, please join our Discord server