Skip to main content
Glama

Apply a migration

migrations_apply
Destructive

Record and apply one migration (name + SQL) in a single transaction, then reload the REST API's schema cache. It is linted first: a table without row level security is blocked. dry_run: true only lints. Destructive SQL needs confirm: true and the destructive scope (production:destructive on production). Scope: database:write.

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

Input Schema

NameRequiredDescriptionDefault
sqlYesThe migration's SQL
nameYesShort snake_case name, e.g. `create_todos`
branchNoBranch id, e.g. `pr-42`. Default `production`.
confirmNotrue only after the user approved the destructive operation
dry_runNoOnly lint and plan; change nothing
versionNoVersion number; default is the current UTC time as YYYYMMDDHHMMSS
project_idNoProject id, e.g. `todo-app`. Default: the last one used, or your only one.
organization_idNoOrganization id, e.g. `acme`. Default: the token's.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior5/5

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

Beyond the annotations (destructiveHint=true, idempotentHint=false), the description discloses that the whole operation runs in a single transaction, that the REST API schema cache is reloaded afterward, that linting blocks tables lacking row level security, and that a specific auth scope (database:write, production:destructive) is required. These are exactly the non-obvious behaviors an agent needs before attempting a destructive write.

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 dense sentences, front-loaded with the core action and side effects, then the lint gate, then the dry_run and confirm rules. The telegraphic fragments ('Scope: database:write.') are efficient rather than wasteful.

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 an 8-parameter destructive mutation with no output schema, the definition covers the safety-critical behavior: transactionality, lint blocking, dry-run preview, confirmation, and scopes. It does not say what a successful response contains or what happens to the migration record when the transaction fails, which is the main remaining gap.

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 every parameter is already documented, and the description mostly restates confirm/dry_run semantics that the schema already carries. It adds a little context by tying confirm to an approved destructive operation and to the required scope, which is why it sits at the baseline rather than below it.

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?

The description names a specific verb and resource ('Record and apply one migration (name + SQL)') and adds the transactional and cache-reload side effects, so the agent knows exactly what the call does. It never names a sibling such as sql_execute, so the distinction from ad-hoc SQL execution must be inferred from the migration-recording framing.

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 states clear preconditions for use: the SQL is linted first, RLS-less tables are blocked, dry_run only lints, and destructive SQL requires confirm plus the destructive scope. It stops short of explicitly telling the agent when to prefer this over sql_execute or when not to use it at all.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources