Skip to main content
Glama
devopam

MCPg - Production-grade PostgreSQL MCP Server

Generate Prisma schema

generate_prisma_schema
Read-only

Read a PostgreSQL schema and emit a valid Prisma .prisma schema string (mirrors prisma db pull). Covers tables, columns, primary/foreign keys, unique constraints, indexes, and enums.

Instructions

Read a PostgreSQL schema and emit a valid Prisma .prisma schema string (mirrors prisma db pull). Covers tables, columns, primary/foreign keys, unique constraints, indexes, and enums. Views, foreign tables, partitions, triggers, functions, and policies are out of scope; unmappable types fall back to Unsupported("..."). Returns the rendered schema.prisma source as a single string. Schema/table/column names must be plain identifiers ([A-Za-z_][A-Za-z0-9_]*); delimited names (hyphens, spaces, mixed-case-only) are not supported here because they become source identifiers in generated code — use SQL tools (export_table, dump_database) for those objects. See docs/identifier-policy.md.

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

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.8

TDQS

A4.1/5.0
Behavior5/5

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

Annotations already declare readOnly and closed-world, and the description adds substantial beyond that: exactly which objects are in scope, which are out of scope (views, partitions, triggers, functions, policies), the `Unsupported("...")` fallback for unmappable types, the single-string return, and the identifier policy constraint.

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?

The action and output are front-loaded in the first sentence, then scope, fallbacks, and constraints follow in a single dense but well-ordered block. It is longer than typical, but nearly every clause carries distinct information.

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?

With an output schema present, return values need no elaboration, and the description still covers in-scope objects, out-of-scope objects, type fallbacks, identifier restrictions, and the escape hatch for unsupported objects. An agent has everything needed to invoke it or divert elsewhere.

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%: the `database` param is documented in the schema itself, but the required `schema` param has no description and the prose never clarifies whether it is a PostgreSQL schema name or the input source. The identifier-policy note adds constraint context but not parameter meaning, so the baseline 3 holds.

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 states a clear verb+resource: it reads a PostgreSQL schema and emits a valid Prisma `.prisma` schema string, explicitly equated with `prisma db pull`. This distinguishes it from the other ORM generators (drizzle, diesel, ecto) by product name, though it never names those siblings to route explicitly.

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?

It gives concrete when-not guidance and alternatives: delimited/hyphen/space/mixed-case names are unsupported here and should go through `export_table` or `dump_database` instead. That is real routing context, but there is no explicit sibling steering among the other generate_*_schema tools.

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