dqsleuth
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| DQSLEUTH_ROOT | No | Project root to scan for data files. Equivalent to the --root flag. | |
| DQSLEUTH_SOURCES | No | Extra files, globs or folders to register, separated by ':'. Equivalent to the repeatable --source flag. | |
| DQSLEUTH_DBT_TARGET | No | Path to the dbt target/ directory. Equivalent to the --dbt-target flag. | |
| DQSLEUTH_POSTGRES_URL | No | Postgres connection URL. Use a read-only database role. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
dqsleuth investigates data quality problems. It is read-only: it cannot modify any source.
Investigate like an analyst, not a test runner:
dq_list_sources to see what is reachable (local CSV/Parquet/DuckDB files, attached Postgres, dbt artifacts).
Form a hypothesis from the symptom, then test it with the narrowest check:
"metric dropped/spiked" -> dq_explain_metric_change, then dq_check_freshness on the table.
"join gives too many/too few rows" -> dq_check_relationship.
"duplicates" -> dq_check_duplicates (it tells re-loads apart from grain problems).
"dbt test failing" -> dq_dbt_test_results, dq_dbt_test_detail, dq_dbt_lineage (walk upstream).
Confirm with dq_run_sql, then report: symptom, evidence, root cause, and the fix, in that order. Never present a hypothesis as a finding without a query result behind it.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| dq_list_sourcesA | List every table dqsleuth can read, where each came from, and whether dbt artifacts were found. Call this first. Tables come from CSV/Parquet/NDJSON files and DuckDB databases discovered under the project root, sources added with dq_add_source, and an optional read-only Postgres attachment. |
| dq_add_sourceA | Register more data for investigation. Files become views; DuckDB databases are attached READ_ONLY. Use for data outside the auto-discovered folders, or to read many partition files as one table via a glob. |
| dq_profile_tableA | Profile a table: row count, and per column the type, null %, distinct count, min/max and mean. Also flags investigation leads: fully-null or constant columns, high null rates, placeholder strings ('N/A', 'null', '') that hide missing values from NULL checks, and likely key columns. |
| dq_check_nullsA | Count NULLs per column, optionally broken down over time to pinpoint when a column started going null. |
| dq_check_duplicatesA | Check whether key_columns are unique, and diagnose what kind of duplication it is. Separates exact duplicate rows (the same record loaded twice: a re-run or overlapping incremental window) from conflicting duplicates (same key, different values: wrong grain or a join fan-out). |
| dq_check_freshnessA | Check how recent the data is and whether volume is steady: latest timestamp, lag from now, rows per period, empty periods (missing loads) and periods with under half the median volume. Gaps and low-volume periods are computed over the whole range; only the latest 60 periods are listed row by row. To check one segment (e.g. a single provider), use dq_run_sql with a GROUP BY. |
| dq_check_relationshipA | Test a join before trusting it: orphaned child keys (rows an INNER JOIN silently drops), NULL foreign keys, and a non-unique parent key (which makes a LEFT JOIN fan out and inflate totals). |
| dq_explain_metric_changeA | Explain why a metric moved: compare a window with its baseline, then attribute the change to segments. For "revenue dropped 35% yesterday": gives the overall change and, per dimension, which segments account for it. A segment flagged 'missing in current window' usually means a feed did not load, which is a data problem rather than a business one. |
| dq_run_sqlA | Run one read-only SELECT to confirm a hypothesis. Any other statement type is rejected. |
| dq_dbt_test_resultsA | Summarise the last dbt test/build run from target/run_results.json: counts by status, and each failing test with its type, column, tested model and failure count, worst first. |
| dq_dbt_test_detailA | Everything needed to explain one dbt test: its definition, config (severity, where), the model it tests, and the compiled SQL that returns the failing rows. |
| dq_dbt_lineageA | Walk dbt lineage from a node, marking every upstream/downstream node that has failing tests. Upstream answers "where did this break?"; downstream answers "what does this break?", including exposures (dashboards) that would show wrong numbers. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| investigate | Run a structured data quality investigation of a symptom. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 12 tools
Most tools have clearly distinct purposes: source discovery, profiling, null checks, duplicates, freshness, relationships, metric attribution, SQL, and dbt diagnostics. There is some overlap between dq_profile_table and dq_check_nulls, and dq_run_sql can be used broadly, but the descriptions make the intended boundaries reasonably clear.
All tools consistently use snake_case with a dq_ prefix, and names are mostly verb_noun or clear resource-action phrases. The dbt tools form a consistent dq_dbt_* subgroup, so the set is predictable despite not every name being verb_noun.
With 12 tools, the server is well-scoped for a data quality investigation toolkit. Each tool appears to earn its place by covering a distinct step in profiling, checking, diagnosing, and dbt triage.
The surface covers the core lifecycle well: source listing/addition, profiling, nulls, duplicates, freshness, relationships, metric change attribution, read-only SQL, and dbt test/lineage diagnostics. Minor gaps exist, such as removing registered sources or explicit schema/type drift checks, but dq_run_sql and profiling provide reasonable workarounds.