Skip to main content
Glama

explain_query

Generate and analyze CockroachDB statement plans to optimize SQL queries. Use EXPLAIN or EXPLAIN ANALYZE to review execution details and improve query performance.

Instructions

Return CockroachDB's statement plan for a preparable statement. You can use this information to optimize the query. If you run it with Analyze, it executes the SQL query and generates a statement plan with execution statistics.

Args: query (str): SQL query to explain. analyze (bool): If True, run EXPLAIN ANALYZE.

Returns: A success message or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analyzeNo
queryYes
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains that the tool returns statement plans and can execute queries with 'analyze' for statistics, but lacks details on permissions, rate limits, or error handling. It adequately covers core behavior without contradictions.

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 well-structured with a purpose statement, usage guidance, and parameter explanations in a logical flow. It is appropriately sized, though the 'Returns' section could be more concise as it repeats obvious success/error outcomes.

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 no annotations and no output schema, the description covers the tool's purpose and parameters adequately but lacks details on return format, error conditions, or integration with sibling tools. It is minimally viable for a 2-parameter tool but has gaps in completeness.

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 description coverage is 0%, so the description must compensate. It clearly explains both parameters: 'query' as the SQL to explain and 'analyze' as a boolean to run EXPLAIN ANALYZE with execution statistics. This adds essential meaning beyond the bare schema.

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 the tool's purpose with specific verbs ('Return CockroachDB's statement plan') and resources ('preparable statement'), distinguishing it from siblings like 'execute_query' or 'analyze_performance' by focusing on query explanation rather than execution or performance analysis.

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

Usage Guidelines4/5

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

The description provides clear context on when to use the tool ('to optimize the query') and mentions the 'analyze' parameter's effect, but does not explicitly state when not to use it or name specific alternatives among the many sibling tools.

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

Related 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/amineelkouhen/mcp-cockroach'

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