Skip to main content
Glama

get_dimensions

Extract dimensions for specified metrics to categorize and analyze data attributes effectively. Ideal for identifying key characteristics in datasets.

Instructions

Dimensions are the attributes, features, or characteristics that describe or categorize data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
metricsYes

Implementation Reference

  • Primary MCP tool handler for 'get_dimensions'. This is the function invoked when the tool is called, which delegates to the SemanticLayerFetcher.
    @dbt_mcp_tool( description=get_prompt("semantic_layer/get_dimensions"), title="Get Dimensions", read_only_hint=True, destructive_hint=False, idempotent_hint=True, ) async def get_dimensions( context: SemanticLayerToolContext, metrics: list[str], search: str | None = None ) -> list[DimensionToolResponse]: return await context.semantic_layer_fetcher.get_dimensions( metrics=metrics, search=search )
  • Core helper function in SemanticLayerFetcher that performs the actual GraphQL query to fetch dimensions and caches the results.
    async def get_dimensions( self, metrics: list[str], search: str | None = None ) -> list[DimensionToolResponse]: metrics_key = ",".join(sorted(metrics)) if metrics_key not in self.dimensions_cache: dimensions_result = await submit_request( await self.config_provider.get_config(), { "query": GRAPHQL_QUERIES["dimensions"], "variables": { "metrics": [{"name": m} for m in metrics], "search": search, }, }, ) dimensions = [] for d in dimensions_result["data"]["dimensionsPaginated"]["items"]: dimensions.append( DimensionToolResponse( name=d.get("name"), type=d.get("type"), description=d.get("description"), label=d.get("label"), granularities=d.get("queryableGranularities") + d.get("queryableTimeGranularities"), ) ) self.dimensions_cache[metrics_key] = dimensions return self.dimensions_cache[metrics_key]
  • Pydantic/dataclass defining the output schema for dimension responses.
    class DimensionToolResponse: name: str type: DimensionType description: str | None = None label: str | None = None granularities: list[str] | None = None
  • List of semantic layer tools including get_dimensions, used for registration into the MCP server.
    SEMANTIC_LAYER_TOOLS = [ list_metrics, list_saved_queries, get_dimensions, get_entities, query_metrics, get_metrics_compiled_sql, ]
  • Toolset definition including get_dimensions for enable/disable configuration.
    Toolset.SEMANTIC_LAYER: { ToolName.LIST_METRICS, ToolName.LIST_SAVED_QUERIES, ToolName.GET_DIMENSIONS,

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