Skip to main content
Glama

refactor_to_calculation_groups

Consolidate repetitive DAX measures like YTD, QTD, and PY into calculation groups to reduce model complexity and standardize time intelligence.

Instructions

Consolidate repetitive measures (e.g. YTD, QTD, PY) into calculation groups.

Use this tool when the user asks to:

  • Refactor or clean up redundant DAX measures using calculation groups.

  • Reduce model complexity and standardize time intelligence calculations.

Args: target: Target PBIP directory or TMDL path. min_candidates: Minimum measure patterns needed to trigger consolidation. reconcile_strategy: "strict" or "lenient". preserve_originals: Whether to keep original measures alongside the calculation group. auto_apply: If True, write calculation items immediately; if False, return proposed refactoring plan. inspector: Optional model inspector. measure_writer: Optional measure writer callable.

Returns: Dict with proposed or applied calculation items, candidate measures, and impact assessment.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYes
inspectorNo
auto_applyNo
measure_writerNo
min_candidatesNo
preserve_originalsNo
reconcile_strategyNostrict

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/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 disclose the key behavioral split: auto_apply=True writes immediately while False returns a proposed plan, and preserve_originals controls whether source measures survive. It does not state reversibility, permissions, or risk of modifying the model, leaving some mutation-safety gaps.

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 one-line purpose followed by scannable trigger list and Args/Returns blocks. The Returns block largely restates what the existing output schema already provides, so it is slightly redundant but not bloated.

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 a mutation tool with no annotations and seven parameters, the definition covers purpose, triggers, every argument, and the plan-vs-apply distinction, and an output schema exists so return shape need not be re-explained. Missing only safety/reversibility context that annotations would normally supply.

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?

Schema coverage is 0%, so the description must compensate, and it documents all seven parameters. Most add real meaning (auto_apply, preserve_originals, reconcile_strategy), though 'inspector: Optional model inspector' and 'measure_writer: Optional measure writer callable' are near-tautological and reconcile_strategy never explains strict vs lenient.

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?

States a specific verb ('consolidate') and resource ('repetitive measures ... into calculation groups') with a concrete example (YTD, QTD, PY), so the agent knows exactly what the tool does. It does not name or distinguish itself from any sibling, which keeps it just short of a 5.

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?

Gives explicit when-to-use triggers ('when the user asks to refactor or clean up redundant DAX measures', 'reduce model complexity'). There is no when-not guidance or named alternative (e.g. add_measure_with_validation), so it is clear but not exhaustive.

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