Skip to main content
Glama
dbt-labs
by dbt-labs

list_metrics

Retrieve a comprehensive list of available metrics from the dbt Semantic Layer. Use it as the initial step to identify relevant metrics for answering data or business-related queries.

Instructions

List all metrics from the dbt Semantic Layer.

If the user is asking a data-related or business-related question, this tool should be used as a first step to get a list of metrics that can be used with other tools to answer the question.

Examples:

  • "What are the top 5 products by revenue?"

  • "How many users did we have last month?"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for list_metrics. It is decorated with @dbt_mcp_tool which likely generates the input/output schema from type hints and delegates to SemanticLayerFetcher.list_metrics.
    @dbt_mcp_tool(
        description=get_prompt("semantic_layer/list_metrics"),
        title="List Metrics",
        read_only_hint=True,
        destructive_hint=False,
        idempotent_hint=True,
    )
    async def list_metrics(
        context: SemanticLayerToolContext, search: str | None = None
    ) -> list[MetricToolResponse]:
        return await context.semantic_layer_fetcher.list_metrics(search=search)
  • Pydantic/dataclass defining the output schema for individual metrics returned by list_metrics tool.
    class MetricToolResponse:
        name: str
        type: MetricType
        label: str | None = None
        description: str | None = None
        metadata: str | None = None
  • The call to register_sl_tools which registers all semantic layer tools (including list_metrics) to the DbtMCP FastMCP server instance.
    logger.info("Registering semantic layer tools")
    register_sl_tools(
        dbt_mcp,
        config_provider=config.semantic_layer_config_provider,
        client_provider=DefaultSemanticLayerClientProvider(
            config_provider=config.semantic_layer_config_provider,
        ),
        disabled_tools=disabled_tools,
        enabled_tools=enabled_tools,
        enabled_toolsets=enabled_toolsets,
        disabled_toolsets=disabled_toolsets,
    )
  • The list of semantic layer tools that includes the list_metrics handler function, used in registration.
    SEMANTIC_LAYER_TOOLS = [
        list_metrics,
        list_saved_queries,
        get_dimensions,
        get_entities,
        query_metrics,
        get_metrics_compiled_sql,
    ]
  • The helper method in SemanticLayerFetcher that performs the actual GraphQL query to fetch metrics list and maps to MetricToolResponse objects.
    async def list_metrics(self, search: str | None = None) -> list[MetricToolResponse]:
        metrics_result = await submit_request(
            await self.config_provider.get_config(),
            {"query": GRAPHQL_QUERIES["metrics"], "variables": {"search": search}},
        )
        return [
            MetricToolResponse(
                name=m.get("name"),
                type=m.get("type"),
                label=m.get("label"),
                description=m.get("description"),
                metadata=(m.get("config") or {}).get("meta", ""),
            )
            for m in metrics_result["data"]["metricsPaginated"]["items"]
        ]
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It describes the tool's purpose and usage context well but lacks details on behavioral traits like rate limits, authentication requirements, pagination, or error handling. The description doesn't contradict any annotations, but it doesn't fully compensate for the lack of structured metadata.

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 a clear purpose statement, usage guidelines, and examples in three concise sentences. Every sentence adds value without redundancy, and it's front-loaded with the core functionality.

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

Completeness4/5

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

Given the tool's simplicity (0 parameters, no output schema), the description provides good contextual completeness by explaining its role in workflows and including examples. However, without annotations or output schema, it could benefit from more details on return format or limitations, though this is less critical for a list operation.

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

Parameters4/5

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

The tool has 0 parameters, and schema description coverage is 100%. The description appropriately doesn't discuss parameters, as none exist. It focuses on the tool's purpose and usage instead, which is sufficient for a parameterless tool.

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 the specific action ('List all metrics') and resource ('from the dbt Semantic Layer'), distinguishing it from sibling tools like 'get_dimensions', 'get_entities', or 'query_metrics'. It precisely defines what the tool does without being vague or tautological.

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?

The description explicitly states when to use this tool ('as a first step to get a list of metrics that can be used with other tools to answer the question') and provides concrete examples of user questions that would trigger its use. This gives clear guidance on its role in a workflow compared to alternatives.

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

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/dbt-labs/dbt-mcp'

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