Skip to main content
Glama

audit_sql_migration_locks

Read-onlyIdempotent

Audit PostgreSQL and MySQL migration DDL for ACCESS EXCLUSIVE lock queues, full table rewrites, non-concurrent index builds, unvalidated foreign keys, and missing lock_timeout guards before deployment.

Instructions

Audits PostgreSQL 14-17 and MySQL 8.0/8.4 DDL statements for ACCESS EXCLUSIVE lock queues, full table rewrites, non-concurrent index builds, unvalidated foreign keys, and missing lock_timeout guards.

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": {
      "sql": "<sql>"
    },
    "name": "audit_sql_migration_locks"
  }
}

Input Schema

NameRequiredDescriptionDefault
qpsNoEstimated peak production queries per second on the target table (defaults to 800).
sqlYesRaw SQL migration script (PostgreSQL or MySQL) to inspect for lock and rewrite hazards.
dialectNoSQL dialect override (defaults to auto-detection between PostgreSQL and MySQL).
tableRowsNoEstimated row count of the target table used for lock duration simulation (defaults to 10000000).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so the safety profile is covered. The description adds real value beyond them by naming the exact hazard categories detected and the engine/version envelope, telling the agent what class of findings to expect and where the tool is out of scope. It still doesn't state that this is purely static analysis against SQL text (no live DB connection) or what the findings look like.

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?

A single front-loaded sentence with the verb first and zero filler; every clause names a distinct hazard the tool checks. The dense noun list is efficient though slightly list-like to read.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Parameters and safety profile are well covered, but with no output schema the description should hint at the shape of the result (severity levels, estimated lock duration derived from qps/tableRows, remediation hints). It also leaves unstated what happens on a mixed or unresolvable dialect under 'auto'.

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%, with documented defaults, minimums, and an enum for dialect, so the schema carries the parameter semantics. The description's engine list loosely corroborates the dialect enum but adds nothing about how qps or tableRows influence lock-duration simulation.

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?

Uses a specific verb ('Audits') on a specific resource ('DDL statements') and enumerates the exact hazard classes it looks for: ACCESS EXCLUSIVE lock queues, table rewrites, non-concurrent index builds, unvalidated FKs, missing lock_timeout. The supported engines and versions (PostgreSQL 14-17, MySQL 8.0/8.4) sharpen the scope. It does not explicitly contrast itself with audit_migration_directory or estimate_ddl_blast_radius, so differentiation is inferred rather than stated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The usage context is implied — you feed it a migration script and get hazard findings, presumably before running the DDL in production. There is no explicit statement of when to prefer this over the sibling directory auditor or the blast-radius estimator, and no stated exclusions such as DML-only scripts or unsupported engine versions.

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