Skip to main content
Glama

simplify_dax_measure

Rewrites DAX expressions into shorter equivalent forms and finds measures written the long way, replacing hand-rolled blank checks or IF chains with built-in functions.

Instructions

Rewrite a DAX expression in its shorter, equivalent form.

Use this tool when the user asks to:

  • Simplify, tidy or shorten a DAX measure.

  • Find the measures in a model that are written the long way.

  • Replace a hand-rolled blank check, error check or IF chain with the function that already does it.

Args: expression: The DAX expression to simplify. Mutually exclusive with pbip_path. pbip_path: A PBIP project to read the measures from. measure: The measure to simplify. Requires pbip_path. all_measures: Simplify every measure in the project and report which ones could be written shorter. Requires pbip_path. apply_lint: Include the linter verdict before and after, so a rewrite that silences a finding — or creates one — is visible.

Returns: Dict with the simplified expression and the rewrites that produced it. The equivalence is structural: the expression is never evaluated against data, so the rewrite changes the shape and not the meaning, and a reader can check it. An expression that could not be parsed comes back unchanged, with the reason.

This tool writes nothing. To apply the result, pass the
simplified expression to add_measure_with_validation.

Input Schema

NameRequiredDescriptionDefault
measureNo
pbip_pathNo
apply_lintNo
expressionNo
all_measuresNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.23.0

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations available, the description carries the full burden and does so well: it states the tool writes nothing, that equivalence is structural rather than data-evaluated, that unparseable input returns unchanged with a reason, and what apply_lint adds. These are exactly the safety and behavior traits an agent needs before calling.

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 a one-line purpose followed by scannable intent bullets, and the Args section is tight. The Returns paragraph is somewhat long and partly restates what an output schema would show, which costs a point but not much.

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?

Given five optional parameters, no annotations, and a moderately complex behavior (structural rewriting, lint comparison), the description covers selection, exclusivity, behavior, and the write-nothing guarantee. Nothing an agent needs to call this 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, and it does for all five parameters: expression vs. pbip_path exclusivity, measure/all_measures requiring pbip_path, and apply_lint's before/after lint verdict semantics. This is meaning the schema alone does not convey.

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 gives a specific verb (rewrite/simplify) applied to a specific resource (a DAX expression/measure), and the bullet list of user intents ('shorten a DAX measure', 'find measures written the long way', 'replace a hand-rolled blank check') makes it distinguishable from near-siblings like abstract_measures or abbreviate_names.

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?

It explicitly enumerates when to use the tool (three concrete user asks), states the mutual-exclusion rule between expression and pbip_path, states the prerequisite that measure/all_measures require pbip_path, and names add_measure_with_validation as the follow-up path for actually applying a result.

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