The type of a foreign term may determined by the goal
foreign_type(+Foreign_term, -Type_name)
Note that foreign_type/2 will fail if Foreign_term is not a foreign term.
foreign_type/2