parameters: (
      sessionId: IdentifierType,
      command_request: CommandRequest,
      session_manager: SessionManager = Depends(get_session_manager),
  )
return_statement: return CommandResponse(
          data=command_result, links=get_valid_session_links(sessionId, router)
      )
docstring: Execute a session command
docstring_summary: Execute a session command
docstring_tokens: Execute a session command
function: async def session_command_execute_handler(
      sessionId: IdentifierType,
      command_request: CommandRequest,
      session_manager: SessionManager = Depends(get_session_manager),
  ) -> CommandResponse:
      """
      Execute a session command
      """
      session_obj = get_session(manager=session_manager, session_id=sessionId)
      if not session_manager.is_active(session_obj.meta.identifier):
          raise CommandExecutionException(
              reason=f"Session '{sessionId}' is not active. "
              "Only the active session can execute commands"
          )
  
      command_result = await session_obj.execute_command(command_request.data)
  
      log.debug(f"Command result: {command_result}")
  
      return CommandResponse(
          data=command_result, links=get_valid_session_links(sessionId, router)
      )
function_tokens: async def session_command_execute_handler ( sessionId : IdentifierType , command_request : CommandRequest , session_manager : SessionManager = Depends ( get_session_manager ) , ) -> CommandResponse : session_obj = get_session ( manager = session_manager , session_id = sessionId ) if not session_manager . is_active ( session_obj . meta . identifier ) : raise CommandExecutionException ( reason = f"Session '{sessionId}' is not active. " "Only the active session can execute commands" ) command_result = await session_obj . execute_command ( command_request . data ) log . debug ( f"Command result: {command_result}" ) return CommandResponse ( data = command_result , links = get_valid_session_links ( sessionId , router ) )