dbt_seed
Load CSV files into a database as seed data for reference tables, test datasets, or static data dependencies. Use this tool to initialize essential data for dbt models.
Instructions
Load CSV files as seed data. An AI agent should use this tool when it needs to load initial data from CSV files into the database. This is essential for creating reference tables, test datasets, or any static data that models will depend on.
Returns:
Output from the dbt seed command as text (this command does not support JSON output format)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exclude | No | Seeds to exclude | |
| profiles_dir | No | Directory containing the profiles.yml file (defaults to project_dir if not specified) | |
| project_dir | No | ABSOLUTE PATH to the directory containing the dbt project (e.g. '/Users/username/projects/dbt_project' not '.') | . |
| selector | No | Named selector to use |
Implementation Reference
- src/tools.py:311-350 (handler)The core handler function for the 'dbt_seed' MCP tool. Decorated with @mcp.tool(), it defines input parameters (schema), constructs the 'dbt seed' command with optional --selector and --exclude flags, executes it using execute_dbt_command, processes the result, and returns the output as a string.@mcp.tool() async def dbt_seed( selector: Optional[str] = Field( default=None, description="Named selector to use" ), exclude: Optional[str] = Field( default=None, description="Seeds 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)" ) ) -> str: """Load CSV files as seed data. An AI agent should use this tool when it needs to load initial data from CSV files into the database. This is essential for creating reference tables, test datasets, or any static data that models will depend on. Returns: Output from the dbt seed command as text (this command does not support JSON output format) """ command = ["seed"] # The --no-print flag is not supported by dbt Cloud CLI # We'll rely on proper parsing to handle any print macros if selector: command.extend(["--selector", selector]) if exclude: command.extend(["--exclude", exclude]) result = await execute_dbt_command(command, project_dir, profiles_dir) # Use the centralized result processor return await process_command_result(result, command_name="seed")
- src/server.py:86-89 (registration)Registration of the 'dbt_seed' tool (along with all other tools) by creating the FastMCP server instance and calling register_tools(mcp), which defines and registers all @mcp.tool()-decorated functions including dbt_seed.mcp = FastMCP("dbt-cli", log_level="ERROR") # Register tools register_tools(mcp)
- src/tools.py:312-329 (schema)Pydantic-based input schema definition for the dbt_seed tool using Field descriptions for parameters: selector, exclude, project_dir, profiles_dir. Output is str.async def dbt_seed( selector: Optional[str] = Field( default=None, description="Named selector to use" ), exclude: Optional[str] = Field( default=None, description="Seeds 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)" ) ) -> str:
- src/tools.py:17-17 (helper)Imports helper functions used by dbt_seed: execute_dbt_command (executes the dbt CLI command) and process_command_result (processes and formats the command output).from src.command import execute_dbt_command, parse_dbt_list_output, process_command_result