Skip to main content

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

ParameterTypeRequiredDescription
databasestringNoFilter by database name. Case-insensitive.
schemastringNoFilter by schema name. Requires database to also be set for meaningful results.
min_sensitivitystringNoMinimum sensitivity level. One of: public, internal, confidential, restricted. Returns tables at this level and above.
compliance_anyarrayNoArray of compliance framework names (e.g., ["GDPR", "HIPAA"]). Returns tables matching any of the listed frameworks.
has_piibooleanNoWhen true, returns only tables that have at least one PII-classified column. When false, returns only tables with no PII columns.
domainstringNoFilter 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:

FieldTypeDescription
full_table_namestringFully qualified table name (DB.SCHEMA.TABLE)
sensitivitystringTable-level sensitivity: public, internal, confidential, or restricted
enforcement_modestringHow policies are enforced: enforced, advisory, or mixed
policy_countintegerNumber of governance policies applied to this table
compliance_frameworksarrayList of compliance frameworks (e.g., ["GDPR", "SOC2"])
has_piibooleanWhether the table contains any PII-classified columns
pii_column_countintegerNumber of columns classified as PII
domainstringBusiness domain assigned to the table
ownerstringData 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.