Discover Context
Type: Function
Search the governance catalog for tables matching specified criteria. Use this tool to find which tables are governed, filter by sensitivity level, locate PII-containing tables, or scope results to a specific compliance framework.
Use Cases
- An AI agent needs to know which tables in a database are governed before building a query
- A compliance workflow filters for all tables subject to GDPR or HIPAA
- A security review identifies all tables containing PII above a certain sensitivity threshold
- A data steward audits governance coverage across schemas in a domain
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
database | string | No | Filter by database name. Case-insensitive. |
schema | string | No | Filter by schema name. Requires database to also be set for meaningful results. |
min_sensitivity | string | No | Minimum sensitivity level. One of: public, internal, confidential, restricted. Returns tables at this level and above. |
compliance_any | array | No | Array of compliance framework names (e.g., ["GDPR", "HIPAA"]). Returns tables matching any of the listed frameworks. |
has_pii | boolean | No | When true, returns only tables that have at least one PII-classified column. When false, returns only tables with no PII columns. |
domain | string | No | Filter by business domain (e.g., "finance", "healthcare", "marketing"). |
All parameters are optional. Calling with no parameters returns all governed tables.
Output Schema
Returns an array of governed table objects:
| Field | Type | Description |
|---|---|---|
full_table_name | string | Fully qualified table name (DB.SCHEMA.TABLE) |
sensitivity | string | Table-level sensitivity: public, internal, confidential, or restricted |
enforcement_mode | string | How policies are enforced: enforced, advisory, or mixed |
policy_count | integer | Number of governance policies applied to this table |
compliance_frameworks | array | List of compliance frameworks (e.g., ["GDPR", "SOC2"]) |
has_pii | boolean | Whether the table contains any PII-classified columns |
pii_column_count | integer | Number of columns classified as PII |
domain | string | Business domain assigned to the table |
owner | string | Data owner or steward responsible for the table |
Example Response
{
"status": "success",
"data": [
{
"full_table_name": "ANALYTICS_DB.CORE.CUSTOMERS",
"sensitivity": "confidential",
"enforcement_mode": "enforced",
"policy_count": 3,
"compliance_frameworks": ["GDPR", "CCPA"],
"has_pii": true,
"pii_column_count": 5,
"domain": "customer_data",
"owner": "data_engineering"
},
{
"full_table_name": "ANALYTICS_DB.CORE.ORDERS",
"sensitivity": "internal",
"enforcement_mode": "advisory",
"policy_count": 1,
"compliance_frameworks": ["SOC2"],
"has_pii": false,
"pii_column_count": 0,
"domain": "transactions",
"owner": "data_engineering"
}
],
"errors": []
}
SQL Examples
Discover all governed tables
SELECT METATATE_APP.CORE.DISCOVER_CATALOG(
OBJECT_CONSTRUCT()
);
Filter by database and minimum sensitivity
SELECT METATATE_APP.CORE.DISCOVER_CATALOG(
OBJECT_CONSTRUCT(
'database', 'ANALYTICS_DB',
'min_sensitivity', 'confidential'
)
);
Find all tables with PII in a compliance framework
SELECT METATATE_APP.CORE.DISCOVER_CATALOG(
OBJECT_CONSTRUCT(
'compliance_any', ARRAY_CONSTRUCT('GDPR', 'HIPAA'),
'has_pii', TRUE
)
);
Filter by domain
SELECT METATATE_APP.CORE.DISCOVER_CATALOG(
OBJECT_CONSTRUCT(
'domain', 'finance'
)
);
JSON Request / Response (API)
When calling through the MCP endpoint, the request body follows the MCP tools/call format:
Request:
{
"method": "tools/call",
"params": {
"name": "discover-context",
"arguments": {
"database": "ANALYTICS_DB",
"min_sensitivity": "confidential",
"has_pii": true
}
}
}
Response:
{
"content": [
{
"type": "text",
"text": "{\"status\":\"success\",\"data\":[{\"full_table_name\":\"ANALYTICS_DB.CORE.CUSTOMERS\",\"sensitivity\":\"confidential\",\"enforcement_mode\":\"enforced\",\"policy_count\":3,\"compliance_frameworks\":[\"GDPR\",\"CCPA\"],\"has_pii\":true,\"pii_column_count\":5,\"domain\":\"customer_data\",\"owner\":\"data_engineering\"}],\"errors\":[]}"
}
]
}
Try it in the app
Open Metatate and navigate to the Test Tools tab to run discover-context interactively with a form-based UI. No SQL or external client needed.