Get the tables and columns of a foreign database.
Logs in to the foreign database with the connection's stored credentials and lists its tables and views with their columns, keys and indexes: what a dataview or virtual view on that connection is built from. The credentials are never returned. 503 when the foreign database cannot be reached. Needs View Query Schema Metadata, View Foreign Data Connections and Use Foreign Data Connections.
| |
|---|
| Scope | connectors:read (sensitive) |
| Asynchronous | No |
| MCP tool | get_foreign_data_connection_database_schema |
| Portal permissions | view_query_schema_metadata, view_foreign_data_connections, use_foreign_data_connections |
Parameters
| Name | In | Type | Required | Description |
|---|
foreign_data_connection_id | path | string | Required | |
Docwize-Version | header | string (date) | Optional | |
If-None-Match | header | string | Optional | Answers 304 when the representation is unchanged (resources that publish an ETag). |
Responses
Errors
The problem codes this operation can answer with. Each code links to its page.
Schemas
ForeignDataColumn
| Field | Type | Required | Description |
|---|
data_type | string | Required | The foreign database's own type name. |
default_value | string or null | Required | |
foreign_column | string or null | Required | |
foreign_table | string or null | Required | The table a foreign key points at. |
is_foreign_key | boolean | Required | |
is_indexed | boolean | Required | |
is_nullable | boolean | Required | |
is_primary_key | boolean | Required | |
is_unique | boolean | Required | |
name | string | Required | |
ordinal_position | integer or null | Required | |
ForeignDataSchema
| Field | Type | Required | Description |
|---|
foreign_data_connection_id | string | Required | |
tables | array of ForeignDataTable | Required | Every table and view the connection's login can see, with its columns. |
ForeignDataTable
| Field | Type | Required | Description |
|---|
columns | array of ForeignDataColumn | Required | |
row_count | string or null | Required | The database's row estimate. |
schema_name | string | Required | The database schema holding the table. |
size_mb | number | Required | |
table_name | string | Required | |
type | string or null | Required | table, view, materialized view or temporary table; null where the database does not say. |