Skip to main content
Glama
NiclasOlofsson

DBT Core MCP Server

test_models

Run dbt tests on models and sources to validate data quality, using constraints like uniqueness and not-null. Supports state-based selection and fail-fast execution.

Instructions

Run dbt tests on models and sources.

When to use: After running models to validate data quality. Tests check constraints like uniqueness, not-null, relationships, and custom data quality rules.

Important: Ensure seeds and models are built before running tests that depend on them.

State-based selection modes (uses dbt state:modified selector):

  • select_state_modified: Test only models modified since last successful run (state:modified)

  • select_state_modified_plus_downstream: Test modified + downstream dependencies (state:modified+) Note: Requires select_state_modified=True

Manual selection (alternative to state-based):

  • select: dbt selector syntax (e.g., "customers", "tag:mart", "test_type:generic")

  • exclude: Exclude specific tests

Args: select: Manual selector for tests/models to test exclude: Exclude selector select_state_modified: Use state:modified selector (changed models only) select_state_modified_plus_downstream: Extend to state:modified+ (changed + downstream) fail_fast: Stop execution on first failure keep_cte_tests: Keep generated CTE test files for debugging (default: False) state: Shared state object injected by FastMCP

Returns: Test results with status and failures

See also: - run_models(): Execute models before testing them - build_models(): Run models + tests together automatically - load_seeds(): Load seeds if tests reference seed data

Examples: # After building a model, test it run_models(select="customers") test_models(select="customers")

# Test only generic tests (not singular)
test_models(select="test_type:generic")

# Test everything that changed
test_models(select_state_modified=True)

# Stop on first failure for quick feedback
test_models(fail_fast=True)

# Keep CTE test files for debugging
test_models(keep_cte_tests=True)

Note: Unit test failures show diffs in the "daff" tabular format: @@ = column headers +++ = row in actual, not in expected (extra row) --- = row in expected, not in actual (missing row) → = row with modified cell(s), shown as old_value→new_value ... = omitted matching rows Full format spec: https://paulfitz.github.io/daff-doc/spec.html

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectNo
excludeNo
select_state_modifiedNo
select_state_modified_plus_downstreamNo
fail_fastNo
keep_cte_testsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description fully bears the transparency burden. It details selection modes (state-based vs manual), fail_fast behavior, keep_cte_tests for debugging, and even the format of unit test failure diffs, leaving no ambiguity about tool behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with sections (When to use, Important, Args, Returns, See also, Examples, Note). Every sentence adds value, and it front-loads the primary purpose. Despite length, it remains clear and avoids redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (6 params, no annotations, high behavioral detail needed), the description covers all aspects: purpose, usage conditions, parameter semantics, return values, sibling tools, and examples. It is complete and self-contained.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate. It explains all 6 parameters: select and exclude as manual selectors, state-based flags with the 'Note:' on prerequisites, fail_fast, keep_cte_tests, and state object. Examples further clarify usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Run dbt tests on models and sources' (specific verb+resource). It distinguishes from siblings like run_models (execution) and build_models (run+tests) through the 'See also' section and usage guidance.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states 'When to use: After running models to validate data quality.' Includes important precondition ('Ensure seeds and models are built') and references alternative tools (run_models, build_models, load_seeds).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/NiclasOlofsson/dbt-core-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server