Skip to main content
Glama

check_before_apply

Validate PostgreSQL migrations before execution and block unsafe DDL by returning a pass/fail verdict based on safety rules and lock classification.

Instructions

Safety gate: call this BEFORE writing or executing any PostgreSQL DDL or migration. Resolves the project's own MigrationPilot config (rule toggles, severity overrides, failOn threshold) exactly like the CLI, then returns a pass/fail verdict. On "fail", do not apply the migration — fix the blocking violations and check again.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesThe exact SQL that is about to be written or executed
pgVersionNoTarget PostgreSQL version. Defaults to the config's pgVersion, or 17.
configPathNoPath to a config file, or a directory to resolve config from. Defaults to searching upward from the working directory, exactly like the CLI.
Behavior4/5

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

With no annotations, the description carries the burden. It discloses that the tool is non-mutating (it is a 'check' that returns a verdict), explains config resolution ('exactly like the CLI'), and instructs the agent on failure behavior. It doesn't explicitly state it makes no writes to the database, but the safety-gate framing and 'returns a verdict' imply it.

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?

Three compact sentences, front-loaded with 'Safety gate.' Each sentence provides necessary context: when to call, what it does, and how to handle the verdict. No redundancy.

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 tool with 3 params and no output schema, the description covers the critical points: use case, behavior, and outcome ('pass/fail verdict'). It could describe the verdict structure or error cases, but for a safety gate the essential info is present.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The description adds only minor reinforcement (e.g., 'exactly like the CLI' for configPath, 'exact SQL' for sql) but no substantive meaning beyond the schema's own descriptions.

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 clearly identifies the tool as a 'Safety gate' with the specific verb 'call this BEFORE writing or executing any PostgreSQL DDL or migration.' It states the function (resolves config, returns verdict) and differentiates from siblings like analyze_migration or suggest_fix because it is explicitly a gate that blocks application.

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?

It explicitly states when to use ('BEFORE writing or executing any PostgreSQL DDL or migration') and provides the rule for fail ('do not apply the migration'). However, it doesn't explicitly state when NOT to use it (e.g., for read-only queries), leaving the exclusion to interpretation.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mickelsamuel/migrationpilot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server