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

MCPg - Production-grade PostgreSQL MCP Server

Compare schemas

compare_schemas
Read-only

Compare two PostgreSQL schemas to find added, removed, or changed tables, columns, indexes, constraints, and foreign keys. Review structural differences before migrations or deployments.

Instructions

Return the structural diff between two schemas — tables/columns/indexes/constraints/foreign-keys added, removed, or changed. Base tables only; views and custom types are not compared. Renames surface as a paired add + remove.

Example: compare_schemas(left_schema='public', right_schema='staging')

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": {
      "left_schema": "<left_schema>",
      "right_schema": "<right_schema>"
    },
    "name": "compare_schemas"
  }
}

Input Schema

NameRequiredDescriptionDefault
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.
left_schemaYes
right_schemaYes

Output Schema

NameRequiredDescriptionDefault
left_schemaYes
right_schemaYes
tables_addedYes
tables_changedYes
tables_removedYes

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.2/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnlyHint=true, openWorldHint=false), and the description goes further with real behavioral context: the granularity of objects diffed, the exclusion of views and custom types, and the notable quirk that renames appear as a paired add + remove rather than as a rename — something an agent could otherwise misreport. It doesn't discuss size/limits of the diff output, which is the only meaningful gap.

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?

Three short sentences front-load the return value, then scope limits, then the rename quirk, with the example last. No filler, and each sentence carries distinct information.

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?

An output schema exists, so the description isn't obligated to explain the diff structure, and for a two-schema comparison tool the stated scope and rename behavior are nearly sufficient. The missing piece is the left/right directionality, which matters for interpreting any diff result.

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%: the database parameter is well documented inline, but left_schema and right_schema have no schema-level descriptions. The example supplies value semantics for those two (schema names such as 'public' and 'staging'), but the description never states the direction of the diff — which side counts as 'added' versus 'removed' — leaving a real risk of inverted interpretation.

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 result object — 'structural diff between two schemas' — and enumerates exactly what is compared (tables/columns/indexes/constraints/foreign-keys). It also carves out scope ('base tables only; views and custom types are not compared'), which cleanly separates it from siblings like list_views, list_composite_types, or generate_schema_diagram.

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?

Explicit exclusions tell the agent when this tool will NOT answer the question (views, custom types), and the worked example demonstrates a concrete call. It stops short of naming an alternative tool for the excluded cases, so the agent must infer that from siblings, but the usage context is otherwise clear.

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