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".

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "export_ddl"
  }
}

Input Schema

NameRequiredDescriptionDefault
dialectNoTarget SQL dialect (default 'postgres')
ifNotExistsNoAdd IF NOT EXISTS to the CREATE TABLEs (default true)
expectedProjectIdNoUUID of the project THIS call targets (overrides the session project).
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. Changed1 schema field changed
    • changedInput schema / properties / expectedProjectId / description
      Previous value: -"UUID of the project THIS call targets (overrides the session project). No access: refused, nothing changed."New value: +"UUID of the project THIS call targets (overrides the session project)."
  2. Changed1 schema field changed
    • changedInput schema / properties / expectedProjectId / description
      Previous 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."New value: +"UUID of the project THIS call targets (overrides the session project). No access: refused, nothing changed."
  3. 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."
  4. 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."
  5. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare a safe read-only, closed-world operation, and the description adds genuinely new behavior: the `warnings` list reports what the dialect cannot express, each entry has a `code` and a table.column, and an empty list means no loss. It does not clarify the primary output channel (returned SQL text vs. written file), which matters for a tool named 'export'.

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 output format, which is the right order. The warnings paragraph is longer than needed and partly redundant ('a script exported without mentioning its losses suggests a faithful conversion' plus 'An empty list really means nothing lost' cover overlapping ground).

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?

With no output schema, the description carries the burden of return-value semantics and does explain `warnings` in detail, including the empty-list case. The remaining gap is the shape of the DDL itself (inline string vs. file path) and whether results are paginated or truncated for large models.

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 dialect, ifNotExists, expectedProjectId and inlineForeignKeys are already fully documented, including the sqlite PRAGMA caveat. The description only restates the dialect options and defaults, adding no meaning beyond the schema; baseline 3 applies.

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 ('Generates the SQL DDL') and enumerates the exact DDL elements produced (CREATE TABLE, CHECK constraints, foreign keys with ON DELETE/ON UPDATE), plus the three target dialects. This clearly separates it from siblings like export_data_model or export_diagram, which would produce non-SQL artifacts.

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?

Gives a real workflow pointer: an inconsistent ERD yields broken SQL, and analyze_data_model checks it upstream, so the agent knows to validate first. It stops short of an explicit 'use X instead when…' exclusion, but the context is clear enough to select the tool correctly.

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.