Skip to main content
Glama
PG Sheets MCP
by hamza533

List Postgres tables

postgres_list_tables
Read-onlyIdempotent

Lists tables and views in allowed PostgreSQL schemas with approximate row counts and comments, helping discover available data before inspecting column details.

Instructions

List the tables and views the AI may query in the allowed schemas (public), with approximate row counts and table comments. Call this first to discover what data exists, then postgres_describe_table for column details.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "postgres_list_tables"
  }
}

Input Schema

NameRequiredDescriptionDefault
schemaNoOnly list this schema. One of: public. Omit to list all allowed schemas.

Output Schema

NameRequiredDescriptionDefault
tablesYes
row_countYesNumber of tables returned.

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 readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is covered. The description adds value beyond that by disclosing the return payload (tables, views, approximate row counts, comments) and the permission-aware scope ("the tables and views the AI may query"), which tells the agent results may be filtered by access rights.

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 earning their place: the first defines output and scope, the second defines workflow position. The discovery-first instruction is front-loaded rather than buried.

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 an output schema present the description need not enumerate return fields, and rich annotations cover the safety profile. For a zero-required-parameter discovery tool, the scope, payload shape, and next-step routing are all present, leaving nothing an agent needs 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%, so the single optional schema parameter is already fully documented, including the permitted value. The description's "(public)" and "allowed schemas" phrasing only lightly reinforces the schema text, so 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 and resource (list tables and views) plus the scope (allowed schemas), and distinguishes itself from postgres_describe_table by assigning column details to that sibling. An agent can tell immediately what this returns versus what the query and describe tools do.

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?

"Call this first to discover what data exists, then postgres_describe_table for column details" gives explicit sequencing and names the natural next tool. It stops short of stating when not to call it (e.g., when the table name is already known), so it falls just below fully explicit when/when-not guidance.

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