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 (environment) id. Optional: defaults to `production`.
confirmNoMust be true to run a destructive operation, after the user approved it
dry_runNoOnly lint and plan; change nothing
versionNoVersion number; default is the current UTC time as YYYYMMDDHHMMSS
project_idNoProject id. Optional: defaults to the project created or used last in this session, or the only one.
organization_idNoOrganization id. Optional: defaults to the token's organization, or the only one you belong to.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true and non-idempotent, but the description goes well beyond that: single-transaction semantics, a lint gate that blocks tables lacking row level security, the schema-cache reload, and the required authorization scopes (database:write, and production:destructive on production). These are exactly the operational consequences 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action and its side effects, and the lint-gate and dry_run clarifications follow in a compact, telegram-style sequence with no filler. The clipped phrasing ('Destructive SQL needs confirm: true and the destructive scope') is dense but still parseable, and nothing is wasted.

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 tool with no output schema, the description covers the transaction boundary, the lint failure mode, the schema-cache reload, and the authorization prerequisites. It stops short of saying what the call returns (e.g., an operation id or applied version) or how failures surface, which is the 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?

With schema description coverage at 100%, the schema already documents name, sql, dry_run, confirm, branch, version, and the id defaults. The description reinforces the dry_run and confirm semantics and adds the scope requirement, but contributes little meaning that is not already in the parameter descriptions.

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?

States a specific verb and resource pair ('Record and apply one migration (name + SQL)') plus the transactional boundary and the schema-cache reload side effect, which is far more precise than the title. It does not, however, distinguish itself from close siblings such as schema.apply, migrate.run, or sql.execute, leaving the agent to infer the difference.

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?

It supplies real operating guidance for the destructive path (dry_run only lints; destructive SQL needs confirm: true) which tells the agent how to proceed safely. It never names an alternative or states when another sibling should be used instead of this one, so the selection guidance is only implied.

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