get_all_models
Retrieve names and descriptions of all dbt models in your environment for comprehensive analysis and management.
Instructions
Get the name and description of all dbt models in the environment.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/dbt_mcp/discovery/tools.py:102-111 (handler)The core handler function for the 'get_all_models' tool. It is decorated with @dbt_mcp_tool which defines its metadata, description, and hints. The function fetches all models using the provided ModelsFetcher.@dbt_mcp_tool( description=get_prompt("discovery/get_all_models"), title="Get All Models", read_only_hint=True, destructive_hint=False, idempotent_hint=True, ) async def get_all_models(context: DiscoveryToolContext) -> list[dict]: return await context.models_fetcher.fetch_models()
- src/dbt_mcp/discovery/tools.py:336-374 (registration)Registration of the discovery tools including get_all_models. The DISCOVERY_TOOLS list includes the handler, and register_discovery_tools binds the context and calls register_tools to add them to the FastMCP server.DISCOVERY_TOOLS = [ get_mart_models, get_all_models, get_model_details, get_model_parents, get_model_children, get_model_health, get_exposures, get_exposure_details, get_all_sources, get_source_details, get_macro_details, get_seed_details, get_semantic_model_details, get_snapshot_details, get_test_details, ] def register_discovery_tools( dbt_mcp: FastMCP, discovery_config_provider: ConfigProvider[DiscoveryConfig], *, disabled_tools: set[ToolName], enabled_tools: set[ToolName], enabled_toolsets: set[Toolset], disabled_toolsets: set[Toolset], ) -> None: def bind_context() -> DiscoveryToolContext: return DiscoveryToolContext(config_provider=discovery_config_provider) register_tools( dbt_mcp, tool_definitions=[tool.adapt_context(bind_context) for tool in DISCOVERY_TOOLS], disabled_tools=disabled_tools, enabled_tools=enabled_tools, enabled_toolsets=enabled_toolsets, disabled_toolsets=disabled_toolsets, )
- Enum definition for the tool name 'get_all_models' used throughout the codebase for references.GET_ALL_MODELS = "get_all_models"
- src/dbt_mcp/tools/toolsets.py:51-68 (registration)The get_all_models tool is mapped to the 'discovery' toolset, enabling toolset-level control.Toolset.DISCOVERY: { ToolName.GET_MART_MODELS, ToolName.GET_ALL_MODELS, ToolName.GET_MODEL_DETAILS, ToolName.GET_MODEL_PARENTS, ToolName.GET_MODEL_CHILDREN, ToolName.GET_MODEL_HEALTH, ToolName.GET_ALL_SOURCES, ToolName.GET_SOURCE_DETAILS, ToolName.GET_EXPOSURES, ToolName.GET_EXPOSURE_DETAILS, ToolName.GET_RELATED_MODELS, ToolName.GET_MACRO_DETAILS, ToolName.GET_SEED_DETAILS, ToolName.GET_SEMANTIC_MODEL_DETAILS, ToolName.GET_SNAPSHOT_DETAILS, ToolName.GET_TEST_DETAILS, },
- src/dbt_mcp/tools/policy.py:91-93 (helper)Policy definition for the get_all_models tool, classifying it as METADATA behavior.ToolName.GET_ALL_MODELS.value: ToolPolicy( name=ToolName.GET_ALL_MODELS.value, behavior=ToolBehavior.METADATA ),