Use INFO to retrieve the schema of a given structure. See also: USE - SurrealDB

INFO FOR [type] [name];

Retrieve all namespaces on server:

INFO FOR KV;
# OUTPUT:
[{ namespaces: { test: 'DEFINE NAMESPACE test' }, users: {  } }]

Retrieve all databases in given namespace:

USE NS [name of namespace];
INFO FOR NS;
# OUTPUT:
[{ databases: { test: 'DEFINE DATABASE test' }, tokens: {  }, users: {  } }]