part-of-speech of 只有
只有 can mean 'only/ just/ merely' in the first example
  
  水深也'只有'十二米 = "The water depth is only/ just/ merely 12M"
  
  '也' before '只有' is a modal word that put emphasis on the 'not substantial' aspect in the term 'only/ just/ merely', if '只有' means 'only', '也只有' would mean 'just only'
  
  只(only) is an adverb for the verb 有 (has)  '十二米' here


~


  只有 can only mean 'only' in the second example, because there is a "才有" (can then have) in the second part of the sentence.
  
  '只有'通过学者的社区考验过的思想，才有活力 = "Only through scholars' socially experimented thinking, can then have life (be alive).."
  
  '才有' in the second part indicates the statement in the first part is a requirement'
  
  只有 (only) is an adverb for the verb 通过 (thought) here