Skip to main content
Glama

dbt_build

Execute a comprehensive dbt build process to run seeds, snapshots, models, and tests in the correct order for complete project deployment and component validation.

Instructions

Run build command (seeds, tests, snapshots, and models). An AI agent should use this tool when it needs to execute a comprehensive build process that runs seeds, snapshots, models, and tests in the correct order. This is ideal for complete project deployment or ensuring all components work together.

Returns: Output from the dbt build command as text (this command does not support JSON output format)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
excludeNoModels to exclude
full_refreshNoWhether to perform a full refresh
modelsNoSpecific models to build, using the dbt selection syntax
profiles_dirNoDirectory containing the profiles.yml file (defaults to project_dir if not specified)
project_dirNoABSOLUTE PATH to the directory containing the dbt project (e.g. '/Users/username/projects/dbt_project' not '.').
selectorNoNamed selector to use

Implementation Reference

  • The core handler for the 'dbt_build' MCP tool. Decorated with @mcp.tool(), it defines input schema via Annotated Fields, constructs the dbt build command based on parameters, executes it using execute_dbt_command, and returns the processed result. This is the exact implementation of the tool logic.
    @mcp.tool() async def dbt_build( models: Optional[str] = Field( default=None, description="Specific models to build, using the dbt selection syntax" ), selector: Optional[str] = Field( default=None, description="Named selector to use" ), exclude: Optional[str] = Field( default=None, description="Models to exclude" ), project_dir: str = Field( default=".", description="ABSOLUTE PATH to the directory containing the dbt project (e.g. '/Users/username/projects/dbt_project' not '.')" ), profiles_dir: Optional[str] = Field( default=None, description="Directory containing the profiles.yml file (defaults to project_dir if not specified)" ), full_refresh: bool = Field( default=False, description="Whether to perform a full refresh" ) ) -> str: """Run build command (seeds, tests, snapshots, and models). An AI agent should use this tool when it needs to execute a comprehensive build process that runs seeds, snapshots, models, and tests in the correct order. This is ideal for complete project deployment or ensuring all components work together. Returns: Output from the dbt build command as text (this command does not support JSON output format) """ command = ["build"] if models: command.extend(["-s", models]) if selector: command.extend(["--selector", selector]) if exclude: command.extend(["--exclude", exclude]) if full_refresh: command.append("--full-refresh") # The --no-print flag is not supported by dbt Cloud CLI # We'll rely on proper parsing to handle any print macros result = await execute_dbt_command(command, project_dir, profiles_dir) # Use the centralized result processor return await process_command_result(result, command_name="build")
  • Input schema definition for the dbt_build tool using pydantic Field annotations with descriptions and defaults.
    models: Optional[str] = Field( default=None, description="Specific models to build, using the dbt selection syntax" ), selector: Optional[str] = Field( default=None, description="Named selector to use" ), exclude: Optional[str] = Field( default=None, description="Models to exclude" ), project_dir: str = Field( default=".", description="ABSOLUTE PATH to the directory containing the dbt project (e.g. '/Users/username/projects/dbt_project' not '.')" ), profiles_dir: Optional[str] = Field( default=None, description="Directory containing the profiles.yml file (defaults to project_dir if not specified)" ), full_refresh: bool = Field( default=False, description="Whether to perform a full refresh" ) ) -> str:
  • src/tools.py:476-476 (registration)
    MCP tool registration decorator for dbt_build.
    @mcp.tool()

Other Tools

Related 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/MammothGrowth/dbt-cli-mcp'

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