Skip to main content
Glama

apply_cleansing_plan

Destructive

Validate and apply a data-cleansing plan. THIS CHANGES REAL DATA in the model's current physical snapshot table. Requires confirm=true.

Instructions

Validate and apply a data-cleansing plan. THIS CHANGES REAL DATA in the model's current physical snapshot table. Requires confirm=true.

Default mode: pass plan directly, built from propose_cleansing_plan's output -- validated against the operation vocabulary and the model's schema before any step runs, same as always.

If this server requires plan approval (DATAVEIL_REQUIRE_PLAN_APPROVAL= true): pass plan_id instead, from a plan that was registered (register_cleansing_plan) and then approved (approve_cleansing_plan) by someone else. confirm=true is still required on top of that approval, not instead of it.

Note: this writes directly to the model's physical table, outside SQLMesh's own state tracking. A FULL-kind model is fully rematerialized on its next scheduled run/plan apply, which will silently undo the cleansing -- it was never folded into the model's SQL definition. Re-apply after any such rerun if the cleansing still applies.

Input Schema

NameRequiredDescriptionDefault
planNo
confirmNo
plan_idNo
model_nameYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.0

TDQS

A4.9/5.0
Behavior5/5

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

The annotations already flag this as destructive and not read-only, but the description adds critical context beyond annotations: it changes real data in the current physical snapshot table, validates against the operation vocabulary and model schema before running, writes outside SQLMesh state tracking, and FULL-kind rematerialization can silently undo the cleansing.

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 key warning that this changes real data. It then structures the default mode, approval mode, and SQLMesh caveat clearly. Despite its length, every section addresses a distinct operational concern for a high-risk tool.

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 the destructive nature, lack of output schema, 0% schema description coverage, and complex approval modes, the description is complete enough to call the tool correctly. It covers validation behavior, safety requirements, mode selection, and the important rematerialization side effect.

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 description coverage is 0%, so the description must carry parameter meaning. It explains `plan` as coming from propose_cleansing_plan output, `plan_id` as coming from a registered and approved plan, and `confirm` as required. It only leaves `model_name` implicit rather than explicitly defined.

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?

States a specific verb and resource: validate and apply a data-cleansing plan. It clearly distinguishes this write operation from siblings like propose_cleansing_plan, register_cleansing_plan, and approve_cleansing_plan.

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?

Explicitly describes the two usage modes: pass `plan` directly by default, or pass `plan_id` when DATAVEIL_REQUIRE_PLAN_APPROVAL is enabled. It also states that approval must come from someone else and that confirm=true is still required, leaving little ambiguity about when to use each path.

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