show
Execute SQL queries to debug and inspect data in dbt projects, with an optional limit parameter to control result size.
Instructions
dbt show executes an arbitrary SQL statement against the database and returns the results. It is useful for debugging and inspecting data in your dbt project. Use the limit argument in place of a SQL LIMIT clause
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| sql_query | Yes |
Implementation Reference
- src/dbt_mcp/dbt_cli/tools.py:158-178 (handler)Handler function for the 'show' tool. Executes 'dbt show --inline <sql_query>' with optional limit, outputting JSON.def show( sql_query: str = Field(description=get_prompt("dbt_cli/args/sql_query")), limit: int = Field(default=5, description=get_prompt("dbt_cli/args/limit")), ) -> str: args = ["show", "--inline", sql_query, "--favor-state"] # This is quite crude, but it should be okay for now # until we have a dbt Fusion integration. cli_limit = None if "limit" in sql_query.lower(): # When --limit=-1, dbt won't apply a separate limit. cli_limit = -1 elif limit: # This can be problematic if the LLM provides # a SQL limit and a `limit` argument. However, preferencing the limit # in the SQL query leads to a better experience when the LLM # makes that mistake. cli_limit = limit if cli_limit is not None: args.extend(["--limit", str(cli_limit)]) args.extend(["--output", "json"]) return _run_dbt_command(args)
- src/dbt_mcp/dbt_cli/tools.py:159-161 (schema)Input schema defined via Pydantic Field descriptions for sql_query (required str) and optional limit (int, default 5).sql_query: str = Field(description=get_prompt("dbt_cli/args/sql_query")), limit: int = Field(default=5, description=get_prompt("dbt_cli/args/limit")), ) -> str:
- src/dbt_mcp/dbt_cli/tools.py:252-261 (registration)Registration of the 'show' tool in create_dbt_cli_tool_definitions as ToolDefinition with fn=show, description from prompt, and annotations indicating read-only, non-destructive, idempotent.ToolDefinition( fn=show, description=get_prompt("dbt_cli/show"), annotations=create_tool_annotations( title="dbt show", read_only_hint=True, destructive_hint=False, idempotent_hint=True, ), ),
- ToolName enum member defining the name 'show' for configuration and toolsets.SHOW = "show"
- src/dbt_mcp/tools/toolsets.py:77-77 (helper)'show' tool included in DBT_CLI toolset for enable/disable configuration.ToolName.SHOW,