Skip to main content
Glama
call518

MCP PostgreSQL Operations

by call518

get_all_tables_stats

Retrieve detailed access and maintenance statistics for every PostgreSQL table to analyze usage patterns and identify maintenance needs; optionally include system catalog tables.

Instructions

[Tool Purpose]: Get comprehensive statistics for all tables (including system tables if requested)

[Exact Functionality]:

  • Show detailed access statistics for all tables in database

  • Include sequential scans, index scans, and tuple operations

  • Provide live/dead tuple estimates and maintenance history

  • Option to include system catalog tables

[Required Use Cases]:

  • When user requests "all tables stats", "complete table statistics", etc.

  • When analyzing overall table usage patterns

  • When investigating table maintenance needs across the database

  • When getting comprehensive database activity overview

[Strictly Prohibited Use Cases]:

  • Requests for table maintenance operations (VACUUM, ANALYZE)

  • Requests for statistics reset or modification

  • Requests for table optimization actions

Input Schema

NameRequiredDescriptionDefault
database_nameNoDatabase name to analyze (uses default database if omitted)
include_systemNoInclude system tables in results (default: False)

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv3.4.3
    • addedInput schema / properties / database_name / description
      Added value: +"Database name to analyze (uses default database if omitted)"
    • addedInput schema / properties / include_system / description
      Added value: +"Include system tables in results (default: False)"
  2. Changed7 schema fields changedv3.4.2
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / database_name / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / database_name / title
      Removed value: -"Database Name"
    • removedInput schema / properties / database_name / type
      Removed value: -"string"
    • removedInput schema / properties / include_system / title
      Removed value: -"Include System"
    • removedOutput schema / properties / result / title
      Removed value: -"Result"
    • removedOutput schema / title
      Removed value: -"_WrappedResult"
  3. Addedv1.0.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations present, the description must carry the disclosure burden and it largely does: it makes clear this is a read-only retrieval, enumerates the content of the returned statistics, and explicitly rules out any mutation (reset, maintenance, optimization). What it omits is operational context — that scanning all tables can be expensive on a large catalog, and any permission requirements — which is the one remaining gap for a no-annotation tool.

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 bracketed headings make the content easy to scan and it is front-loaded with purpose. The three prohibited-use bullets are near-synonyms (maintenance / reset / optimization are all 'not a mutation tool'), which is minor redundancy that keeps it from a 5.

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?

With only two optional parameters and an output schema in place, the description needn't explain return values, and it covers purpose, content, triggers, and exclusions thoroughly. The only missing element is cost/scale caveat for a whole-catalog scan, a modest gap for this complexity level.

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 schema already documents both database_name and include_system; the description only echoes the system-tables option ('including system tables if requested'). That echo is consistent and mildly reinforcing but adds no syntax or default behavior beyond the structured fields, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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 — 'get comprehensive statistics for all tables' — and the functionality list pins down exactly which statistics (sequential scans, index scans, tuple operations, live/dead tuples). The 'all tables' scope implicitly separates it from single-table siblings like get_table_size_info or get_index_usage_stats, though it never names an alternative explicitly.

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?

It provides both a 'Required Use Cases' list and a 'Strictly Prohibited Use Cases' list, telling the agent exactly which phrasings should route here and which requests (VACUUM, ANALYZE, stats reset, optimization) belong elsewhere. That is the full when/when-not pattern.

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