Skip to main content
Glama

Compact schema overview

pg_schema_overview
Read-onlyIdempotent

Map a PostgreSQL schema into a compact overview of tables, keys, row counts, views, and routines to guide query writing before deeper table inspection.

Instructions

Give a compact map of one schema that costs few tokens: one line per table in the form orders(id bigint PK, customer_id int FK->customers.id, status order_status) with primary keys, foreign key targets, unique columns and the estimated row count, then the views (with their columns) and the number of functions, procedures and sequences.

Use it first when you need to write queries against a schema. Partitions are folded into their parent. limit caps the number of tables. For one table in full detail use pg_describe_table.

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": "pg_schema_overview"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
schemaYes
connectionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

The annotations already establish that this is a read-only, idempotent, non-destructive operation with no open-world behavior. Beyond that, the description adds meaningful behavioral context: it discloses token efficiency, the exact output line format, inclusion of primary keys, foreign key targets, unique columns, estimated row counts, views with columns, counts of functions/procedures/sequences, and the fact that partitions are folded into their parent. These details go well beyond the structured 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 compact and front-loaded: it first states the tool's purpose and output format, then gives usage guidance and an alternative. Every sentence adds useful information, including the exact line format example, partition behavior, limit semantics, and pointer to pg_describe_table. There is no redundant or filler wording.

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?

Given the complexity of schema introspection and the lack of an output schema, the description does a strong job explaining what the tool returns and how to use it. It covers the main output structure, limits, partition folding, and the relevant alternative tool. The only notable gap is that the 'connection' parameter is left undocumented, which prevents a perfect completeness score.

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 0%, so the description must compensate for undocumented parameters. It clarifies that 'schema' selects one schema and that 'limit' caps the number of tables, which is useful. However, the 'connection' parameter is not explained at all, so the description only partially compensates for the low schema coverage.

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 states a specific verb and resource: produce a compact map of one schema. It goes further by specifying exactly what the map contains, including one line per table with PK/FK/unique/row-count details, views with columns, and counts of functions, procedures, and sequences. It also distinguishes itself from pg_describe_table by positioning itself as the overview tool versus the full-detail tool for one table.

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?

The description gives explicit usage guidance: 'Use it first when you need to write queries against a schema.' It also names the alternative for deeper inspection: 'For one table in full detail use pg_describe_table.' The 'limit' behavior is explained, and the partition-folding rule is stated, leaving little ambiguity about when and how to use this tool.

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