Skip to main content
Glama
MCPg - Production-grade PostgreSQL MCP Server

MCPg - Production-grade PostgreSQL MCP Server

Generate schema docs

generate_schema_docs
Read-only

Generates a detailed Markdown reference for a PostgreSQL schema's tables, columns, constraints, indexes, views, foreign tables, and enums, with optional sample values.

Instructions

Generate a detailed Markdown reference of a schema's tables, columns, constraints, indexes, views, foreign tables, and custom enums along with comments / descriptions. Optional include_samples fetches a few distinct, non-null values for each column. Returns a single Markdown document as a string.

Example: generate_schema_docs(schema='public', include_samples=true)

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": {
      "schema": "<schema>"
    },
    "name": "generate_schema_docs"
  }
}

Input Schema

NameRequiredDescriptionDefault
schemaYes
databaseNoOptional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected.
include_samplesNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.4
    • changedInput schema / properties / database / description
      Previous value: -"Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids."New value: +"Optional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected."
  2. First observedv0.6.8

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so safety is covered, and the description usefully adds that it returns a single Markdown string and that include_samples probes distinct non-null values per column (an extra read cost). It does not disclose cost/size behavior for large schemas or whether samples can be slow on big tables, which are the remaining behavioral risks for this 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?

Three sentences plus one inline example, front-loaded with purpose, then optional behavior, then return type. The example earns its place by showing call syntax with both key params. No filler, though the enumeration of object types is long enough that it slightly crowds the opening.

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 read-only annotations and an output schema present, the description need not explain return structure, and it still names the return type. For a 3-parameter documentation generator it covers purpose, optional enrichment, and output form adequately; only edge cases (very large schemas, missing schema, secondary-database read-only implications) are unaddressed.

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 only 33% - only `database` is documented in the schema (configured secondary id, non-id names rejected). The description compensates for `include_samples` by explaining exactly what is fetched ('a few distinct, non-null values for each column'), which is genuinely additive over a bare boolean default. However, the required `schema` parameter gets no semantic detail (case sensitivity, search_path, behavior when the schema does not exist), leaving one of three params thin.

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?

The description opens with a specific verb and resource ('Generate a detailed Markdown reference of a schema's tables, columns, constraints, indexes, views, foreign tables, and custom enums'), which is far more precise than the title alone. It implicitly separates itself from the granular list_*/describe_table siblings by being a whole-schema document generator, though it never names a sibling like generate_schema_diagram or get_compact_schema to draw the contrast explicitly.

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?

Usage is implied rather than stated: an agent can infer this is for producing comprehensive documentation of one schema, and the include_samples sentence hints at when to enrich it. There is no explicit when-not guidance and no routing to alternatives such as generate_schema_diagram (visual) or list_tables (raw enumeration), which is a missed opportunity given the very large sibling set.

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

Deploy Server

Other Tools