Skip to main content
Glama

Describe a database object

pg_describe_object
Read-onlyIdempotent

Inspect PostgreSQL non-table objects—functions, sequences, types, indexes, triggers, extensions, and schemas—to view definitions, signatures, settings, and dependencies without catalog queries.

Instructions

Describe one object that is not a table: a function, procedure, aggregate, sequence, type, index, trigger, extension or schema.

Functions show every overload with arguments, return type, language, volatility, security definer, parallel safety, cost, settings, comment and source code. Sequences show type, range, last value, percent used and owning column. Types show enum labels, domain base type and checks, composite attributes or range subtype. Extensions show their version and the objects they created.

name is name or schema.name; a trigger can be table.trigger, and a function accepts a signature such as shop.order_total(bigint). max_source_chars cuts long function bodies. For tables and views use pg_describe_table.

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": {
      "name": "<name>",
      "kind": "<kind>"
    },
    "name": "pg_describe_object"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindYes
nameYes
connectionNo
max_source_charsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already cover the safety profile (read-only, idempotent, non-destructive, closed-world), so the description correctly spends its words on behavior beyond that: exactly what is returned per object kind, including function overloads, sequence percent-used and owning column, and objects an extension created. This is essential because there is no output schema.

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?

Scope and exclusion come first, then the per-kind return details, then naming syntax, then the sibling redirect. The long return-detail sentence is dense but earns its place because nothing else documents return values.

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?

Given no output schema and no schema descriptions, the description supplies the return-content knowledge an agent needs. It falls short only on the unexplained `connection` parameter and on a minor inconsistency: the text says 'an object that is not a table' while the kind enum also accepts table, view and materialized_view.

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 coverage is 0%, so the description must carry parameter meaning, and it does for the two parameters that matter: `name` accepts bare, schema-qualified, table-qualified trigger and function-signature forms, and `max_source_chars` truncates long function bodies. `kind` is self-documented by its enum, but `connection` (default null) is never explained, leaving a gap.

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, then enumerates the exact object kinds covered (function, procedure, aggregate, sequence, type, index, trigger, extension, schema) and explicitly excludes tables. It names the sibling to use instead, so an agent can tell it apart from pg_describe_table without reading either 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?

Gives an explicit routing rule: 'For tables and views use pg_describe_table.' Combined with the kind enumeration, an agent knows both when this tool applies and which alternative to pick otherwise.

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