Skip to main content
Glama
25andresbernal

semantic-model-kit

query_metric

Run governed metric queries with group-by dimensions and filters, returning rows and the exact SQL executed for transparent results.

Instructions

Compile a metric query and run it against the model's DuckDB warehouse.

Args: metric: metric name, e.g. "revenue". by: dimensions to group by, each as "entity.field", e.g. ["customers.region"]. See describe_metric's allowed_dimensions for what is safe to pass here. where: filter clauses, each as "entity.field op value", e.g. ["calendar.fiscal_year = 2025"]. limit: maximum rows to return (default 100).

Returns columns, rows, and the exact SQL that was run, so the caller can show its work rather than just asserting a number. Raises a tool error, never a guess, if a dimension is unknown, a join between two required entities is ambiguous or unreachable, or the metric is declared non_additive_over a dimension in by.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
byNo
limitNo
whereNo
metricYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It does well by stating what the tool returns (columns, rows, exact SQL) and explicitly enumerating error conditions: unknown dimensions, ambiguous/unreachable joins, and non-additive dimensions. It could add an explicit read-only/no-mutation statement, but for a query tool the return and error behavior is well covered.

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 front-loaded with the core purpose and then organized into Args, Returns, and Raises sections. Each sentence adds functional value: parameter formats, examples, default behavior, and error semantics. There is no filler or redundancy.

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

Completeness5/5

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

For a 4-parameter tool with an output schema and no annotations, the description is complete. It explains all input formats, the return shape, default limit, and failure modes, and even relates to sibling describe_metric for what dimensions are safe. Nothing essential for calling the tool correctly is missing.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate for the bare input schema. It does: metric is exemplified, by is given with entity.field format and a concrete example plus a pointer to describe_metric, where is given with entity.field op value format and an example, and limit is documented with its default. Every parameter receives meaning beyond the schema.

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 opens with a specific verb and resource: 'Compile a metric query and run it against the model's DuckDB warehouse.' It clearly identifies the tool as executing metric queries, which distinguishes it from sibling tools that list or describe entities/metrics or explain joins.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear context for when to use the tool: to query a metric with grouping and filtering. It also points the caller to describe_metric for allowed_dimensions, which serves as indirect guidance on using a sibling tool for safe inputs. It stops short of explicitly stating when not to use query_metric or naming alternatives for other scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.