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

Compare files with recorded history

diff_history
Read-onlyIdempotent

Compare repository migration files against the recorded migration history by version to identify pending, deleted, renamed, or mismatched entries; read-only bookkeeping check.

Instructions

Compare the repository migration files with the recorded history table by version: only in repo (not recorded: pending, or applied by hand without recording), only in database (recorded, but no file has that version: deleted, renamed or from another branch) and in both (a different name is flagged). Compares bookkeeping only, not database objects: follow up with verify_migration for versions only in the repo. 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

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "diff_history"
  }
}

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).

Output Schema

NameRequiredDescriptionDefault
diffYesnull when the history table is missing or cannot be read
historyYesWhether the recorded migration history could be read
directoryYesMigrations directory, relative to the project directory when it is inside it

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare read-only, non-destructive, idempotent, closed-world, but the description goes further: it says it reads pg_catalog inside a READ ONLY transaction, never executes migration SQL, and never writes. It also discloses the required connection prerequisite (PGMV_DATABASE_URL or DATABASE_URL) and the failure mode when it is unset.

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?

Purpose is front-loaded and every clause carries information, including the three bucket definitions. It is dense with parentheticals and reads as one long block; splitting the prerequisite and read-only guarantees into their own lines would improve scanability slightly.

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 one-parameter comparison tool with an output schema, the description covers everything an agent needs: what is compared, what each bucket means, that name mismatches are flagged, what is explicitly out of scope, the read-only guarantee, and the connection prerequisite with its error behavior.

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?

With only one optional parameter at 100% schema description coverage, the schema already explains path resolution, project-directory containment, and the PGMV_MIGRATIONS_DIR default. The description does not add any path or filtering semantics of its own, so it sits at the baseline for fully documented parameters.

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?

"Compare the repository migration files with the recorded history table by version" gives a specific verb and resource, then enumerates the three result buckets (only in repo, only in database, in both with a name mismatch). An agent can distinguish this from verify_migration because the description explicitly scopes it to bookkeeping rather than database objects.

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 states a boundary condition and routes the agent onward: "Compares bookkeeping only, not database objects: follow up with verify_migration for versions only in the repo." That names the sibling and the condition that selects it, which is exactly the when/when-not guidance an agent needs.

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