Skip to main content
Glama
pg-migration-verify
by ColeUD

Verify one migration

verify_migration
Read-onlyIdempotent

Verify a Postgres migration was actually applied by comparing every object it should create, alter or drop against the live catalog, independent of the history table. Read-only; reports MATCH or MISMATCH.

Instructions

Check whether one migration was really applied by comparing every object it should create, alter or drop with the live Postgres catalog, independently of the history table. Use it after applying a migration (e.g. by pasting it into the Supabase SQL editor) or whenever it is unclear whether a migration ran. Reports MATCH n/n or MISMATCH n/n with every problem object and the line it comes from, and whether the version is recorded in supabase_migrations.schema_migrations. Meaning of the output: MATCH = every object the migration should leave behind exists as written. MISMATCH = at least one object is MISSING (not found), DIFFERENT (found with other attributes, e.g. type or nullability) or UNEXPECTED (dropped or renamed by the migration but still there). MATCH* = a MATCH that does not show the file ran (every check would also hold without it), so "NOT recorded" there does not mean applied by hand. NOTHING TO VERIFY = no statement yields a catalog check. SUPERSEDED = a later migration drops or rebuilds the object or what it depends on (or IF NOT EXISTS skipped the statement), so it cannot be checked against this file; objects renamed later are checked under their new name. UNVERIFIABLE = a statement that cannot be checked against the catalog (DO blocks, GRANTs, data changes); review it by hand. Read-only: it reads migration files and pg_catalog inside a READ ONLY transaction, and never runs migration SQL or writes anything. Needs a database URL (PGMV_DATABASE_URL or DATABASE_URL); without one it returns an error saying how to configure it.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "file": "<file>"
    },
    "name": "verify_migration"
  }
}

Input Schema

NameRequiredDescriptionDefault
dirNoMigrations directory. Relative paths are resolved against the project directory. It must be inside the project directory or the configured migrations directory. Omit to use the configured directory (PGMV_MIGRATIONS_DIR, default supabase/migrations).
fileYesThe migration: its file name (20240101120000_create_profiles.sql), a path ending in it, its version (20240101120000) or its name (create_profiles). Only exact matches count.
verboseNoAlso list objects that match and statements that were ignored. Default false: only problems, superseded objects and unverifiable statements are listed.

Output Schema

NameRequiredDescriptionDefault
notesYes
checksYesEvery check of this migration, matching ones included
historyYesWhether the recorded migration history could be read
migrationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the readOnlyHint/idempotent annotations: it explains it reads pg_catalog inside a READ ONLY transaction, never executes migration SQL, writes nothing, and requires PGMV_DATABASE_URL or DATABASE_URL, returning an actionable error when absent. It also pre-empts misreading the result by explaining that MATCH* and "NOT recorded" do not prove the file ran.

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?

Purpose and prerequisites are front-loaded, then the result vocabulary is defined in a compact legend. Every clause carries distinct information — MATCH vs MATCH*, NOTHING TO VERIFY, SUPERSEDED, UNVERIFIABLE are each defined in a single phrase with no repetition.

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?

For a read-only verification tool with three documented parameters and an output schema, the description covers purpose, when to run it, the credential prerequisite, the read-only guarantee, and how to interpret each status token. Nothing needed to call it correctly or to avoid misreading the result is missing.

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 coverage is 100%, so dir/file/verbose are already documented, including the accepted forms of the file argument and the verbose default. The description adds only implicit meaning (the file is a repo migration that may be pasted into the SQL editor) and says nothing about how ambiguous or wrongly-scoped file values behave, so the schema carries the load.

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 ("check whether one migration was really applied") plus the mechanism (comparing expected objects against the live Postgres catalog, independent of the history table). The word "one" plus the sibling name verify_all makes the scope difference inferable without opening a schema.

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 concrete triggering contexts: after applying a migration, or whenever it is unclear whether a migration ran. It does not explicitly contrast itself with verify_all or diff_history, so an agent must infer when the batch variant is preferable, but the single-migration context is clear.

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