Skip to main content
Glama
Yash-0620

postgres-mcp

by Yash-0620

explain_query

Read-only

Explains SQL query execution plans with cost estimates. Supports actual runtime statistics and hypothetical index simulations for query optimization.

Instructions

Explains the execution plan for a SQL query, showing how the database will execute it and provides detailed cost estimates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL query to explain
analyzeNoWhen True, actually runs the query to show real execution statistics instead of estimates. Takes longer but provides more accurate information.
hypothetical_indexesNoA list of hypothetical indexes to simulate. Each index must be a dictionary with these keys: - 'table': The table name to add the index to (e.g., 'users') - 'columns': List of column names to include in the index (e.g., ['email'] or ['last_name', 'first_name']) - 'using': Optional index method (default: 'btree', other options include 'hash', 'gist', etc.) Examples: [ {"table": "users", "columns": ["email"], "using": "btree"}, {"table": "orders", "columns": ["user_id", "created_at"]} ] If there is no hypothetical index, you can pass an empty list.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

The readOnlyHint annotation is true, so the description doesn't need to disclose safety, but it adds value by specifying the output (execution plan and cost estimates). However, it does not mention that it is read-only or that no data is modified, nor does it describe potential blocking or rate limits. The description complements annotations but does not exceed minimal expectations.

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 description is a single sentence with two clear clauses, very concise and to the point. It front-loads the core action. However, it could be slightly improved by adding a mention of hypothesized indexes or the output format without becoming verbose.

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

Completeness3/5

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

Given that there is an output schema (mentioned but not shown) and 100% schema coverage, the description is adequate but minimal. It does not mention the key feature of hypothetical indexes, which is a significant capability. The description could be more complete to fully inform the agent of all tool capabilities.

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 all parameters thoroughly. The tool description does not add any additional parameter-level information beyond what is in the schema. The baseline score of 3 is appropriate given that the description does not need to compensate for missing schema docs.

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 uses the specific verb 'Explains' and identifies the resource as 'execution plan for a SQL query', clearly distinguishing it from siblings like execute_sql (which executes) and analyze_query_indexes (which analyzes indexes). It also mentions 'showing how the database will execute it' and 'provides detailed cost estimates', providing a clear, unique purpose.

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?

The description implies usage for analyzing query plans but does not explicitly state when to use this tool versus alternatives like execute_sql or analyze_query_indexes. No usage context, exclusions, or recommendations are provided, leaving the agent to infer from sibling names.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Yash-0620/postgres-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server