Skip to main content
Glama

export_ddl

Read-only

Generates the SQL DDL (CREATE TABLE + CHECK constraints + foreign keys with their ON DELETE/ON UPDATE actions) from the ERD, for postgres (default), mysql or sqlite. Exporting an inconsistent ERD produces broken SQL: analyze_data_model checks it upstream. ⚠️ warnings lists what the target dialect CANNOT express (each entry carries a code and names the table.column concerned). These losses are meant for the user, in plain words: a script exported without mentioning its losses suggests a faithful conversion. An empty list really means "nothing lost".

Input Schema

NameRequiredDescriptionDefault
dialectNoTarget SQL dialect (default 'postgres')
ifNotExistsNoAdd IF NOT EXISTS to the CREATE TABLEs (default true)
expectedProjectIdNoUUID of the project targeted by THIS call. ACTUALLY targets this project instead of the session project. Refused without changing anything if access is not granted.
inlineForeignKeysNoInline the FK constraints in the CREATE TABLE rather than in separate ALTER TABLEs (default false). IGNORED for sqlite, which does not know ALTER TABLE ADD FOREIGN KEY: keys are inlined there in every case, and the script emits `PRAGMA foreign_keys = ON`, without which sqlite does not enforce them.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / dialect / description
      Previous value: -"Dialecte SQL cible (défaut 'postgres')"New value: +"Target SQL dialect (default 'postgres')"
    • changedInput schema / properties / expectedProjectId / description
      Previous value: -"UUID du projet visé par CET appel. Cible RÉELLEMENT ce projet au lieu du projet de session. Refusé sans rien modifier si l'accès n'est pas accordé."New value: +"UUID of the project targeted by THIS call. ACTUALLY targets this project instead of the session project. Refused without changing anything if access is not granted."
    • changedInput schema / properties / ifNotExists / description
      Previous value: -"Ajouter IF NOT EXISTS aux CREATE TABLE (défaut true)"New value: +"Add IF NOT EXISTS to the CREATE TABLEs (default true)"
    • changedInput schema / properties / inlineForeignKeys / description
      Previous value: -"Inliner les contraintes FK dans le CREATE TABLE plutôt qu'en ALTER TABLE séparés (défaut false). IGNORÉ pour sqlite, qui ne connaît pas ALTER TABLE ADD FOREIGN KEY : les clés y sont TOUJOURS inlinées, et le script émet `PRAGMA foreign_keys = ON` sans lequel sqlite ne les applique pas."New value: +"Inline the FK constraints in the CREATE TABLE rather than in separate ALTER TABLEs (default false). IGNORED for sqlite, which does not know ALTER TABLE ADD FOREIGN KEY: keys are inlined there in every case, and the script emits `PRAGMA foreign_keys = ON`, without which sqlite does not enforce them."
  2. Changed1 schema field changed
    • changedInput schema / properties / inlineForeignKeys / description
      Previous value: -"Inliner les contraintes FK dans le CREATE TABLE plutôt qu'en ALTER TABLE séparés (défaut false). IGNORÉ pour sqlite, qui ne connaît pas ALTER TABLE ADD FOREIGN KEY : les clés y sont TOUJOURS inlinées, et le script pose `PRAGMA foreign_keys = ON` sans lequel sqlite ne les applique pas."New value: +"Inliner les contraintes FK dans le CREATE TABLE plutôt qu'en ALTER TABLE séparés (défaut false). IGNORÉ pour sqlite, qui ne connaît pas ALTER TABLE ADD FOREIGN KEY : les clés y sont TOUJOURS inlinées, et le script émet `PRAGMA foreign_keys = ON` sans lequel sqlite ne les applique pas."
  3. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Annotations only declare readOnlyHint/openWorldHint, so the description carries most of the burden and adds genuine context: dialect-inexpressible losses surface in `warnings`, each with a code and table.column, and an empty list truly means nothing was lost. With no output schema, it explains that one return field well, though the shape of the primary return (the script itself) is left to inference.

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 and dialect scope are front-loaded in the first sentence, followed by the validation prerequisite and the warnings caveat. The parentheticals and emoji add a little bulk, but each clause still conveys distinct information.

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 read-only export with no output schema, the description covers purpose, dialect scope, upstream validation, and the semantics of the `warnings` field, with per-parameter refusal behavior already in the schema. Only the general return contract is under-described.

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%, so all four parameters are already documented, including the sqlite inlining/PRAGMA caveat. The description only restates the dialect list and its default, adding no syntax or behavior beyond the schema — baseline 3 for full coverage.

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 artifact — generating SQL DDL (CREATE TABLE + CHECK constraints + FKs with ON DELETE/ON UPDATE) from the ERD — and enumerates the three target dialects. This is clearly distinguishable from siblings like export_data_model, export_diagram, or list_data_model_formats.

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?

Explicitly routes the agent to analyze_data_model as the upstream validation step ('Exporting an inconsistent ERD produces broken SQL'), which is real when-to-use guidance. It does not, however, contrast itself against the other export_* siblings or say when a different export format should be preferred.

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.