Skip to main content
Glama

Read a system view

pg_stat_view
Read-onlyIdempotent

Read system views and catalog tables from pg_catalog or information_schema by name, including views without a dedicated tool or added by newer PostgreSQL versions.

Instructions

Read any system view or catalog table from pg_catalog or information_schema by name, for example pg_stat_user_functions, pg_stat_slru, pg_stat_ssl, pg_prepared_xacts, pg_stat_wal, pg_stat_replication or pg_replication_slots.

Use it for everything that has no dedicated tool, and for views added by newer PostgreSQL versions. view is name or schema.name; columns selects columns (all by default); order_by sorts by a column, largest first unless descending=false. Names are checked against the real columns on this server. Catalogs that hold credentials (pg_authid, pg_shadow, pg_user_mapping...) are refused.

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": {
      "view": "<view>"
    },
    "name": "pg_stat_view"
  }
}

Input Schema

NameRequiredDescriptionDefault
viewYes
limitNo
columnsNo
order_byNo
connectionNo
descendingNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare read-only, idempotent, non-destructive, and closed-world behavior, so the safety profile is covered. The description adds real behavioral context on top: names are validated against actual server columns, and credential-bearing catalogs (pg_authid, pg_shadow, pg_user_mapping) are refused — an important access constraint an agent cannot infer from annotations. It stops short of describing the result shape or default row-limit behavior, which keeps it from a 5.

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?

The purpose and examples are front-loaded, followed by usage routing, then parameter semantics, then the safety note. The example list is long but each entry demonstrates a distinct catalog type, and no sentence is filler.

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?

For a six-parameter generic read tool with no output schema and only boilerplate annotations, the description covers purpose, routing, key parameter formats, and refusal rules. The gaps are the undocumented `limit`/`connection` parameters and the absence of any hint about returned row shape, but the tool's function is otherwise clear enough to invoke correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description carries the burden and does so well for the core parameters: `view` accepts `name` or `schema.name`, `columns` selects a subset (all by default), and `order_by` sorts largest-first unless `descending=false`, which clarifies the non-obvious default. However, `limit` (default 50) and `connection` receive no explanation anywhere, leaving two of six 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 names a specific verb and resource ('Read any system view or catalog table from pg_catalog or information_schema by name') and immediately lists concrete examples (pg_stat_user_functions, pg_stat_slru, pg_replication_slots). An agent can distinguish it from the dedicated pg_* siblings without inspecting 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 Guidelines5/5

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

It gives explicit routing guidance: 'Use it for everything that has no dedicated tool, and for views added by newer PostgreSQL versions.' That is a clear when-to-use rule that pushes the agent toward specialized siblings when one exists, with no ambiguity about the fallback case.

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