Skip to main content
Glama
mcp-server-postgres

mcp-server-postgres

by Ismail-2001

explain

Runs EXPLAIN (FORMAT JSON) on a SQL statement to return cost estimates and a plan summary, helping you inspect query performance before execution.

Instructions

Run EXPLAIN (FORMAT JSON) and attach cost estimate and plan summary.

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": {
      "sql": "<sql>"
    },
    "name": "explain"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYes
paramsNo
analyzeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description carries the full burden yet says nothing about whether the statement is executed, whether it is read-only, or what permissions are needed. The presence of an 'analyze' flag is especially risky since EXPLAIN ANALYZE actually runs the query, and that consequence is never disclosed.

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?

A single front-loaded sentence with zero filler; the output format and return contents come first. It is efficient, though the terseness contributes to the disclosure gaps noted elsewhere.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a three-parameter tool with an execution-affecting analyze flag, no annotations, and no output schema, the description leaves too much unsaid. It does not describe the plan/cost return shape or the danger of the analyze path, so an agent cannot call it safely on description alone.

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

Parameters2/5

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

Schema description coverage is 0% for all three parameters, so the description must compensate and does not: sql, params, and analyze are never explained. 'FORMAT JSON' is a fixed clause, not a parameter, so it adds no parameter meaning.

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 names a specific verb (run EXPLAIN) plus the exact output form (FORMAT JSON) and what is returned (cost estimate and plan summary), so an agent can tell this apart from query/nl_query. It stops short of naming the sibling it contrasts with, but the resource is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

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

Usage is only implied: an agent can infer this is the tool for inspecting a plan rather than fetching rows, but nothing states when to prefer it over query, or that it should precede a costly query. No exclusions or prerequisites are given.

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