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

MCPg - Production-grade PostgreSQL MCP Server

Generate Prisma schema

generate_prisma_schema
Read-only

Read a PostgreSQL schema and emit a valid schema.prisma string covering tables, columns, primary/foreign keys, unique constraints, indexes, and enums for Prisma projects.

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.

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_prisma_schema"
  }
}

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.

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

A4.8/5.0
Behavior5/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; the description goes further by disclosing the unmappable-type fallback to `Unsupported("...")` and the strict identifier policy that will reject certain objects. These are behavioral constraints an agent cannot infer from the annotations or schema.

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 purpose and output artifact, then scope, then edge-case behavior, then a pointer to a policy document. Every sentence carries information, but the middle section is dense and the external `docs/identifier-policy.md` reference adds a follow-up step that may not be resolvable by the agent.

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?

An output schema exists, so return values need not be explained, yet the description still notes the rendered `schema.prisma` comes back as a single string. Combined with explicit out-of-scope objects, type fallback behavior, and identifier constraints, an agent has everything required to call this correctly or pick a different tool.

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

Parameters4/5

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

Schema coverage is 50%: the `database` parameter is documented in the schema (secondary read-only database id, reject unknown names), but the `schema` parameter has no schema-level description. The description partially compensates by stating that schema/table/column names must be plain identifiers matching `[A-Za-z_][A-Za-z0-9_]*`, which constrains what the `schema` argument can be, but it never says explicitly that `schema` is the target PostgreSQL schema name.

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+resource pair ("Read a PostgreSQL schema and emit a valid Prisma `.prisma` schema string") and anchors it to a familiar reference point (`prisma db pull`). The output artifact is named concretely, so an agent can distinguish it from sibling generators like generate_drizzle_schema or generate_diesel_schema 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 Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly enumerates what is in scope (tables, columns, PK/FK, unique constraints, indexes, enums) and what is not (views, foreign tables, partitions, triggers, functions, policies). It also routes the unsupported case to named alternatives — `export_table` and `dump_database` — with the reason (delimited names become source identifiers), which is exactly the when-not/alternative guidance an agent needs.

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