Skip to main content
Glama

Describe a table

pg_describe_table
Read-onlyIdempotent

Inspect a PostgreSQL table, view, materialized view, or foreign table to see columns, keys, constraints, indexes, triggers, policies, partitions, size, and stats before writing queries.

Instructions

Describe one table, view, materialized view or foreign table: columns with types, defaults and comments; primary key, foreign keys (both directions), unique and check constraints; indexes with size and usage; triggers; row security policies; partitions; size, estimated rows and last vacuum/analyze.

table is name or schema.name. Read this before writing a query against a table. detail="summary" returns only columns and keys.

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

Input Schema

NameRequiredDescriptionDefault
tableYes
detailNofull
connectionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint=false and destructiveHint=false, so the safety profile is covered. The description still adds genuine behavioral content by disclosing the exact shape and depth of the returned catalogue metadata and how `detail="summary"` truncates it. It does not mention cost, permissions, or latency on very large/pressured catalogues, which for a read-only introspection call is a modest omission.

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?

The first sentence is long but is a dense, scannable inventory of returned objects rather than filler, and the two follow-up sentences front-load the identifier format and the guidance to read before querying. Slight tightening is possible (the enumerated clause could be a compact list), but nothing is redundant.

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?

There is no output schema, so the description must describe the return values, and it does so thoroughly enough that an agent knows the report's sections before calling. The `connection` parameter and the default `detail` value are the only unexplained pieces, which is minor for a single-object read-only introspection tool.

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 carry all parameter meaning. It does explain the accepted `table` format (`name` or `schema.name`) and what `detail="summary"` yields, but only describes the non-default enum value and never states that `detail="full"` is the default that produces everything listed in the first sentence. The `connection` parameter receives no explanation at all, leaving one of three parameters undocumented.

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 opens with a specific verb+resource ("Describe one table, view, materialized view or foreign table") and then enumerates exactly what the report contains: columns/types/defaults/comments, PK/FK in both directions, unique and check constraints, indexes with size and usage, triggers, RLS policies, partitions, size and vacuum stats. That enumeration also scopes it away from catalogue-wide siblings like pg_list_tables, so an agent can tell what it gets without opening the 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?

It gives a clear trigger: "Read this before writing a query against a table," which tells the agent when this tool precedes pg_query. It also implies a cheap-vs-rich choice via `detail="summary"` returning only columns and keys. There is no explicit when-not or named alternative (e.g. pg_get_ddl for DDL), so it stops short of a 5.

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