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

MCPg - Production-grade PostgreSQL MCP Server

Summarize table

summarize_table
Read-only

Returns a one-stop table snapshot with columns, keys, constraints, indexes, storage/row-count/vacuum stats, and optional sample rows. Use it to inspect structure and health in one call.

Instructions

Return a one-stop snapshot of a table: columns, primary key, foreign keys, every other constraint, indexes, storage + row-count + last-vacuum/analyze stats, and (optionally) a short sample of rows. Replaces what would otherwise be 4-5 individual tool calls. Set sample_rows=0 on wide / jsonb-heavy tables where the sample isn't useful.

Example: summarize_table(schema='public', table='users', sample_rows=5)

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>",
      "table": "<table>"
    },
    "name": "summarize_table"
  }
}

Input Schema

NameRequiredDescriptionDefault
tableYes
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.
sample_rowsNo

Output Schema

NameRequiredDescriptionDefault
statsYes
tableYes
schemaYes
columnsYes
indexesYes
constraintsYes
primary_keyYes
sample_rowsYes
foreign_keysYes

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

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the description only needs to add context, and it does: it discloses that real row data is returned by default (sample_rows defaults to 5) and advises disabling it on wide/jsonb-heavy tables, which is a genuine cost/data-exposure signal. It stops short of saying whether sampling respects RLS or how expensive the stats collection is on very large relations.

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 outcome ('one-stop snapshot') before the content list, and the sibling-substitution claim follows immediately. The enumerated payload is long but each item earns its place by telling the agent it can skip the narrow tools; the trailing example is useful, though the paragraph is a single dense run-on sentence that could be split for scanability.

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 return shape needn't be explained, and the annotations carry the safety profile — the description covers the remaining burden well by naming what is aggregated and how to suppress the row sample. The one omission relative to a multi-object introspection tool is any hint about cost or permissions on large or restricted tables.

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 25% (only `database` is documented in the schema), so the description must carry more weight. It does add real semantics for sample_rows — default is a sample of rows and 0 disables it — and the example shows schema/table/sample_rows together. However, `schema` and `table` remain bare strings with no qualification guidance (case sensitivity, search_path, whether unqualified names work), leaving a meaningful gap at this coverage level.

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 resource ('Return a one-stop snapshot of a table') and then enumerates exactly what the snapshot contains: columns, PK, FKs, constraints, indexes, storage/row-count/vacuum-analyze stats, optional row sample. The line 'Replaces what would otherwise be 4-5 individual tool calls' positions it against the granular siblings (describe_table, list_indexes, list_constraints, list_foreign_keys) without needing to open 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 Guidelines4/5

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

Gives a clear selection rule (use this instead of chaining 4-5 narrower tools) and one explicit tuning condition: set sample_rows=0 on wide/jsonb-heavy tables where the sample isn't useful. It does not name a specific fallback sibling for the case where the caller only needs one slice (e.g. list_indexes alone), so the when-not side is only partially covered.

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