Skip to main content
Glama
multi-postgres-mcp-server

multi-postgres-mcp-server

by VKirill

pg_explain

Run EXPLAIN ANALYZE on a SQL query to return its execution plan without side effects, since the query is always rolled back. Use it to inspect query performance.

Instructions

Run EXPLAIN ANALYZE on a query and return the execution plan. The query is always rolled back to prevent side effects.

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": {
      "database": "<database>",
      "query": "<query>"
    },
    "name": "pg_explain"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesSQL query to analyze
paramsNoOptional query parameters for $1, $2, ... placeholders
databaseYesDatabase label from config

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full burden. It does disclose an important behavior — the query is executed and then rolled back — but it omits key caveats: EXPLAIN ANALYZE actually runs the query (cost/latency), rollback does not undo non-transactional effects such as sequence increments or external side effects in volatile functions, and no permission or timeout requirements are stated.

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 short sentences, front-loaded with the operation and followed immediately by the safety behavior. Nothing is redundant or wasted.

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 simple three-parameter tool with full schema documentation and no output schema, the description covers what it does, what it returns, and the rollback safety property. The remaining gap is guidance on when to reach for this instead of pg_query.

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 coverage is 100% (query, params, database are all documented in the schema), so the baseline of 3 applies. The description adds no meaning about parameter usage or placeholder binding beyond what the schema already states.

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?

Names the specific operation (EXPLAIN ANALYZE), the target (a query), and the return value (execution plan). It does not distinguish itself from the sibling pg_query, so an agent must infer that this is the plan-inspection variant rather than plain execution.

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

Usage Guidelines2/5

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

There is no explicit when-to-use or when-not-to-use guidance and no mention of the obvious alternative, pg_query. The intended use case (performance/plan debugging) is only inferable from the phrase 'execution plan'.

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