Skip to main content
Glama
dicoy

sqlens-mcp

by dicoy

explain_query

Analyze SQL query performance by retrieving execution plans from Postgres, MySQL, or SQLite databases. Identify and resolve slow queries efficiently.

Instructions

Run EXPLAIN ANALYZE (Postgres) or EXPLAIN (MySQL/SQLite) on a SELECT query to show the execution plan. Useful for diagnosing slow queries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSELECT statement to explain
paramsNoPositional parameters matching the query
connectionNoNamed connection to use. Defaults to the default connection.
Behavior2/5

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

With no annotations provided, the description carries full weight but only discloses database-specific syntax differences (Postgres vs MySQL/SQLite). It fails to mention that EXPLAIN is read-only and does not modify data, and omits permission or side-effect details.

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 description is two sentences with no fluff, front-loading the action and purpose, then adding a use case. Every sentence provides value.

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 three parameters, no output schema, and no annotations, the description adequately conveys the tool's purpose but is incomplete. It does not describe the output format (execution plan structure) or potential errors, which would help the agent understand return values.

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%, so the baseline is 3. The description does not add parameter-specific meaning beyond what the schema already provides (e.g., describing 'sql' as 'SELECT statement to explain' is similar).

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 clearly states that the tool runs EXPLAIN ANALYZE on Postgres and EXPLAIN on MySQL/SQLite for SELECT queries to show execution plans, differentiating it from sibling tools like run_query which executes queries.

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 mentions it is 'useful for diagnosing slow queries,' providing basic usage context. However, it lacks explicit guidance on when not to use this tool (e.g., for non-SELECT statements) or direct comparisons to alternatives like run_query.

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/dicoy/sqlens-mcp'

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