Skip to main content
Glama

apply_schema

Destructive

Applies a validated schema diff to the live Directus data model, creating, altering and dropping collections and fields. Run diff_schema first, keep a snapshot backup, and pass confirm: true.

Instructions

Applies a diff from diff_schema to the live data model, creating, altering and dropping collections and fields. Requires confirm: true. Destructive and not transactional: a mirror-mode diff drops whatever is missing from the snapshot, and a failure partway leaves the model half-migrated. The hash ties the diff to the model it was computed against and the call is refused when the model has moved since; force bypasses that check and can corrupt the model. Always run diff_schema first and keep a get_schema_snapshot backup.

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": {
      "diff": "<diff>"
    },
    "name": "apply_schema"
  }
}

Input Schema

NameRequiredDescriptionDefault
diffYesThe { hash, diff } object returned by diff_schema
forceNoBypass the hash and version safety check
confirmNoConfirm application

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv12.3.3

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, but the description goes well beyond them: non-transactional semantics, mirror-mode dropping anything absent from the snapshot, partial-failure leaving a half-migrated model, the hash/version refusal, and the corruption risk of force. These are the operational consequences an agent cannot infer from the annotation flags alone.

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?

Four sentences, front-loaded with the action and immediately followed by the hard requirement, then the risk profile, then the safe workflow. No filler, and each sentence carries a distinct, decision-relevant fact.

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 a destructive, non-transactional mutation with no output schema, the description covers preconditions, failure modes, and the safety check thoroughly. It stops short of saying what a successful call returns or how to recover from a half-migrated state, which would close the last gap for an agent operating without an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description earns above that by explaining what the hash actually does (binds the diff to the model version it was computed against) and why force is dangerous rather than merely 'bypassing a check'. The confirm parameter is described as a requirement rather than just a boolean, adding a gating nuance the schema does not convey.

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 ('Applies a diff ... to the live data model') and enumerates the concrete effects (creating, altering, dropping collections and fields). It explicitly ties itself to the sibling diff_schema as the source of its input, so an agent can distinguish it from read-only siblings like get_collection_schema.

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?

Gives an explicit prerequisite ordering ('Always run diff_schema first') and a named companion action ('keep a get_schema_snapshot backup'), plus a hard gate ('Requires confirm: true'). It also flags the risky escape hatch (force) and the condition under which the call is refused, 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.