Skip to main content
Glama

add_measure_with_validation

Add a DAX measure to a Power BI model with automatic linting and validation. Catch syntax and best-practice issues before saving.

Instructions

Add a DAX measure to a semantic model with automated linting and validation.

Use this tool when the user asks to:

  • Create or add a new DAX measure to a Power BI model.

  • Validate DAX syntax and best practices (preventing division by zero, unformatted measures, etc.).

  • Dry-run a measure to check for lint issues before committing to TMDL.

Args: target: Target PBIP directory or TMDL path. measure_name: Name of the measure to create. table: Target table where the measure will reside. expression: DAX formula for the measure (e.g. "DIVIDE([Total Sales], [Units], 0)"). format_string: Format string (e.g. "$#,##0.00", "0.0%"). description: Measure documentation or business description. is_hidden: Whether the measure should be hidden in report view. fail_on_severity: Minimum lint severity that blocks creation ("error", "warning", "info"). dry_run: If True, validate lint rules without writing to disk. runtime_check: Whether to execute the measure against an active engine if connected. measure_writer: Optional custom measure writer callable.

Returns: Dict with success status, lint findings, and modified file paths.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYes
targetYes
dry_runNo
is_hiddenNo
expressionYes
descriptionNo
measure_nameYes
format_stringNo
runtime_checkNo
measure_writerNo
fail_on_severityNowarning

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses dry_run semantics (validate without writing to disk), fail_on_severity blocking behavior, runtime_check requiring an active engine connection, and that file paths are modified. It omits important mutation behavior such as what happens when measure_name already exists (overwrite vs. error) and permission requirements, which keeps it below 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the one-line purpose, then a compact bulleted when-to-use block and an Args/Returns structure. It is slightly long, but since the schema has zero description coverage the per-parameter list earns its place rather than duplicating structured data.

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?

For an 11-parameter write tool with no annotations, the description covers purpose, triggers, parameter meaning, and even return shape (which the output schema already provides). The remaining gap is edge-case behavior — collision with an existing measure of the same name, and what 'lint findings' look like when creation is blocked.

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% and there are 11 parameters, so the description must compensate entirely — and it does, documenting every argument with concrete examples ('DIVIDE([Total Sales], [Units], 0)', '$#,##0.00', '0.0%') and enumerating fail_on_severity values (error/warning/info). This adds substantial meaning the schema does not provide.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear specific verb+resource: 'Add a DAX measure to a semantic model', with the distinguishing scope 'automated linting and validation'. An agent can separate this from execute_dax_query or run_dax_regression by the write-plus-validate framing, but no sibling is named explicitly, so it falls short of full sibling differentiation.

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 bullet list gives concrete trigger conditions ('Create or add a new DAX measure', 'Dry-run a measure to check for lint issues before committing to TMDL'), which is real when-to-use guidance. However it never states when NOT to use it or which sibling to reach for instead (e.g. edit existing measure, execute_dax_query for read-only checks).

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