Skip to main content
Glama
PG Sheets MCP
by hamza533

Describe a Postgres table

postgres_describe_table
Read-onlyIdempotent

Describe a PostgreSQL table or view to inspect columns, types, nullability, defaults, comments, primary keys, and foreign keys before writing correct queries and JOINs.

Instructions

Describe one table or view: columns with types, nullability, defaults and comments, the primary key, foreign keys to other tables, and foreign keys from other tables (use these to write correct JOINs). Call before writing a query against a table you haven't seen.

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

Input Schema

NameRequiredDescriptionDefault
tableYesTable or view name, optionally schema-qualified (e.g. orders or public.orders).
schemaNoSchema of the table. Defaults to public.

Output Schema

NameRequiredDescriptionDefault
kindYes
nameYes
columnsYes
commentYes
row_countYesNumber of columns.
primary_keyYes
schema_nameYes
foreign_keysYesKeys in this table referencing other tables.
referenced_byYesKeys in other tables referencing this one (columns are in the other table).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive and closed-world, so safety is covered. The description adds value beyond them by disclosing the shape of the payload (keys, both FK directions) and the intended use of the FK data for JOIN construction.

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?

Two sentences, both front-loaded: the capability list comes first and the usage instruction second. No filler or repetition of the title.

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?

Output schema exists so return values need no prose, and annotations carry the safety profile. For a two-parameter read tool, purpose, contents and call timing are all covered with nothing material missing.

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 100% and the schema already explains both `table` (optionally schema-qualified, with an example) and `schema` (defaults to public). The description adds no syntax or format detail beyond that, so the baseline 3 applies.

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 ('Describe') and resource ('one table or view') and then enumerates exactly what comes back: columns with types, nullability, defaults, comments, the primary key, and inbound/outbound foreign keys. That enumeration makes it unambiguously the metadata-inspection tool rather than the sibling listing or query tools.

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 an explicit trigger: 'Call before writing a query against a table you haven't seen,' plus a reason (write correct JOINs). It doesn't name a sibling alternative or state when not to use it, so it falls short of full when/when-not routing.

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