Skip to main content
Glama
db-conn-mcp

db-conn-mcp

get_database_schema

Retrieves an entire database schema as JSON or a self-contained SQL DDL script, so you can inspect structure or recreate tables, keys, indexes, and triggers.

Instructions

Get the whole database's schema at once, as JSON or as a runnable SQL script.

format="json" (default): every table with columns, types, nullability, primary key, and foreign keys. format="sql": a SELF-CONTAINED DDL script that recreates the schema — tables, columns, sequences, PK/FK/UNIQUE/CHECK, indexes, trigger functions, and triggers — so running it rebuilds the structure. No extra tools needed; covers the common cases (for a byte-faithful dump use dump_schema_faithful).

Output is deterministic. Returned inline by default; pass output_dir to instead WRITE it to {database}_schema_{UTC}.{json|sql} and get back the path plus a summary — recommended for large schemas too big to return inline.

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": {
      "database": "<database>"
    },
    "name": "get_database_schema"
  }
}

Input Schema

NameRequiredDescriptionDefault
formatNojson
databaseYes
output_dirNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden and does so: it discloses output determinism, that the SQL is self-contained and covers "the common cases" but is not byte-faithful, and the side effect of writing to disk with the exact filename pattern plus a path+summary return. That is unusually complete disclosure for an unannotated tool.

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, then format modes, then output destination. Dense and mostly waste-free, though the run-on enumeration of DDL objects and the parenthetical about dump_schema_faithful could be tightened slightly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, and the description adequately fills that gap by describing both return modes and the file naming convention. For a three-parameter read tool with an optional filesystem side effect, nothing an agent needs in order to call it correctly is missing.

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

Parameters5/5

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

Schema coverage is 0%, so the description must compensate and does: it explains what each format value produces (JSON structure vs self-contained DDL with tables, sequences, constraints, indexes, triggers) and precisely what output_dir changes (write to `{database}_schema_{UTC}.{json|sql}` and return path plus summary instead of inline). No parameter is left unexplained.

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 ("Get the whole database's schema") and immediately distinguishes the two output modes. It also names a sibling (dump_schema_faithful) as the byte-faithful alternative, so an agent can separate this from get_table_schema and dump_schema_faithful without opening any schema.

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 concrete selection guidance: json is the default for structured inspection, sql when you need a runnable DDL script, and dump_schema_faithful when byte-faithfulness matters. Also recommends output_dir for large schemas. It stops short of saying when to prefer get_table_schema over this for a single table, but the 'whole database' framing implies it.

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