Skip to main content
Glama
devopam

MCPg - Production-grade PostgreSQL MCP Server

Generate Drizzle schema

generate_drizzle_schema
Read-only

Converts a PostgreSQL schema into a Drizzle ORM TypeScript schema, covering tables, columns, keys, constraints, defaults, and enums.

Instructions

Read a PostgreSQL schema and emit a Drizzle ORM TypeScript schema string (drizzle-orm/pg-core). Covers tables, columns with PG-native types, primary/foreign keys, unique constraints, indexes, defaults, and enums. Single-column FKs emit column-level .references(); composite FKs are a documented v1 gap. Views, foreign tables, partitions, triggers, and functions are out of scope. Returns the rendered TypeScript schema.ts source as a single string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaYes
databaseNoOptional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

The description adds significant context beyond the readOnlyHint=true annotation. It details exactly which database objects are covered, which are not, documents a known gap (composite FKs), and clarifies that the output is a single string. No contradiction with annotations.

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?

The description is concise and well-structured. The first sentence states the main action, followed by specific coverage details, limitations, and out-of-scope items. Every sentence adds value with no redundancy.

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?

Given the tool's simplicity (2 parameters, simple input) and the existence of an output schema, the description is complete. It covers what the tool does, what it covers, its limitations, and what is excluded. No additional context is needed for an AI agent to select and invoke it correctly.

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 coverage is 50%; only the 'database' parameter has a description in the schema. The description mentions 'Read a PostgreSQL schema' which clarifies the intent of the first parameter but does not specify its format or meaning (e.g., schema name like 'public'). While it adds some value, it could better explain the required 'schema' parameter.

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?

The description clearly states it reads a PostgreSQL schema and emits a Drizzle ORM TypeScript schema string. It specifies the exact scope (tables, columns, keys, constraints) and explicitly lists what is out of scope (views, foreign tables, etc.). This distinguishes it from sibling tools like generate_diesel_schema or generate_ecto_schemas, which target different ORMs.

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?

The description implies usage for generating Drizzle schemas but does not explicitly compare to alternative schema generators or provide when-not-to-use guidance. It does document a known limitation (composite FKs are a v1 gap), which helps set expectations. Missing explicit exclusion or alternative references prevents a 5.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/devopam/MCPg'

If you have feedback or need assistance with the MCP directory API, please join our Discord server