Data quality MCP and SQL reference
Contents
Data quality isn't available to every project. Contact support to request access or share feedback.
Use the PostHog MCP server to discover subjects, create and manage checks, start runs, read results, and change schedules. Use the data quality information-schema tables to list existing coverage and analyze recent outcomes with SQL.
Permissions and scopes
Every data quality operation requires query access. You also need access to the subject and every other subject that the check reads.
- Read operations require viewer access to the subject.
- Creating, updating, deleting, or running a check requires editor access to its subject.
- Updating a schedule requires editor access to the scheduled subject.
- A
relationshipscheck also requires access to its target. - A
custom_sqlcheck requires access to every table or view selected by the query. - Metric checks require Data Catalog access. Table, view, and PostHog-table checks require warehouse object access.
For a personal API key, include query:read and the matching subject scope. Use warehouse_table:read or warehouse_table:write for warehouse and PostHog tables, warehouse_view:read or warehouse_view:write for views, and data_catalog:read or data_catalog:write for metrics. The broader warehouse_objects:read and warehouse_objects:write scopes also grant access to warehouse subjects.
PostHog filters subject discovery, definitions, results, health, and notifications with the same access rules. A subject that you can't read doesn't appear as a partial or redacted row.
Unified MCP tools
The data quality MCP surface has eight enabled tools. These tools work across tables, views, metrics, and PostHog tables, so you don't need a subject-specific tool name.
| Tool | Use it to |
|---|---|
data-quality-subjects | List subjects you can read, their IDs, columns, time columns, and whether you can edit them. |
data-quality-check-types | List supported check types and their configuration schemas. Pass subject_type to narrow the result. |
data-quality-check-create | Create a check or return an existing check with the same subject and assertion. |
data-quality-check-update | Change a check's definition or presentation without changing its subject or history. |
data-quality-check-run | Start one check and return its suite run. |
data-quality-check-results | Read the check's recent executions, counts, errors, and compiled diagnostic queries. |
data-quality-check-schedule | Update the schedule for a metric or PostHog table. |
data-quality-check-delete | Soft-delete a check while keeping its run history queryable. |
Create and run a check
Start with subject discovery instead of guessing an ID:
- Call
data-quality-subjects. - Find the subject and copy its
subject_typeandid. - Call
data-quality-check-typeswith the subject type. - Query
system.information_schema.data_quality_checksto avoid creating overlapping coverage. - Call
data-quality-check-create.
For example, create an error-severity check on orders.customer_id:
The create tool is idempotent for the same subject and assertion. A near-duplicate with different configuration creates separate coverage, so inspect existing checks first.
Call data-quality-check-run with the returned check id, and save the suite id that it returns. The tool returns this suite run before the individual check finishes. Poll the historical results from data-quality-check-results with the check ID until a result whose suite_run equals the saved suite ID is passed, failed, errored, or skipped. Inspect that matched result.
Update or delete a check
Call data-quality-check-update with the check ID to change its name, description, type, column, configuration, severity, enabled state, or tags. The subject is fixed. An update keeps the check ID, latest status, and run history.
Call data-quality-check-delete to soft-delete a check. The definition no longer runs, but its retained past rows remain in system.information_schema.data_quality_check_runs. A deleted check releases its name and assertion so you can create them again as a new check.
Manage schedules
Call data-quality-check-schedule with subject_type, subject_uuid, and at least one setting to change:
The schedule tool supports metric and posthog_table subjects. It rejects table and view because their checks run after data changes. The supported intervals are 1hour, 6hour, 12hour, 24hour, and 7day.
A subject gets its schedule when you add its first check. The unified MCP tool can update a schedule, but it can't read the current settings. To inspect them, open Data Warehouse > Data quality and expand the metric or PostHog table. A metric's Tests tab shows the same controls. If an update returns an uncertain result, reload that page before you make another MCP call.
Query check definitions
Use system.information_schema.data_quality_checks to find active definitions:
Filter by subject_name, subject_type, check_type, or enabled when you need a smaller result. subject_status = 'orphaned' means the subject no longer resolves.
Query recent runs
Use system.information_schema.data_quality_check_runs to inspect recent failed and errored runs:
This table is bounded to the newest 500 readable runs. A soft-deleted check's retained run rows keep their check_id. The value becomes null only if the check definition is later hard-deleted. Use data-quality-check-results when you need the compiled query from a specific check run.
Query subject health
Use system.information_schema.data_quality_health to find subjects that need attention:
The health table includes enabled checks only. Subjects with no checks don't appear. An empty information-schema result can also mean you don't have permission to read the matching subjects.