Skip to main content
Glama

Compare two schemas or environments

pg_compare_schemas
Read-onlyIdempotent

Compare a PostgreSQL schema across two read-only connections to identify objects only in the source or target and differing definitions, including tables, columns, indexes, views, and functions.

Instructions

Compare one schema on two connections (for example development and production, or before and after a migration): what exists only in the source, only in the target, and what differs.

Compared: tables, columns (type, nullability, default, identity), indexes, constraints, views (definition), functions (signature, language, volatility and a hash of the body), sequences and types.

schema is the schema on the source; target_schema the schema on the target when it has another name. include limits the comparison to some of the kinds. Both connections are read only, and both follow their approval rules. Nothing is changed.

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": {
      "source_connection": "<source_connection>",
      "target_connection": "<target_connection>",
      "schema": "<schema>"
    },
    "name": "pg_compare_schemas"
  }
}

Input Schema

NameRequiredDescriptionDefault
schemaYes
includeNo
target_schemaNo
source_connectionYes
target_connectionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, and the description reinforces this with the useful addition that both connections follow their approval rules and nothing is changed. It also discloses comparison depth, including a hash of function bodies, which is behavior beyond what annotations convey.

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 the core action and result shape, then a compact inventory of compared objects, then parameter notes. The enumeration of compared kinds earns its space, though the second paragraph is a dense run-on that could be tightened slightly.

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 no output schema, the description still tells the agent what the result contains (source-only, target-only, differing). Given five parameters at 0% schema coverage and no output schema, it covers the necessary ground: scope, comparison surface, parameter intent, and safety posture.

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 description coverage is 0%, so the description must carry the load: it explains `schema` as the source schema, `target_schema` as the target-side name when different, and `include` as a filter over the comparable object kinds. Only `source_connection` and `target_connection` go unexplained, and their meaning is largely self-evident from the opening sentence.

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?

Names a specific verb and resource with precise scope: 'Compare one schema on two connections' and enumerates exactly what is diffed (tables, columns, indexes, constraints, views, functions, sequences, types). This clearly distinguishes it from the single-connection introspection siblings like pg_list_schemas or pg_describe_table.

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?

Gives concrete when-to-use framing with examples ('development and production, or before and after a migration'), which makes the intended scenario obvious. It does not name an alternative or state when not to use it, so it falls short of full routing guidance.

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